Commit 618e02c7 authored by Lennart Poettering's avatar Lennart Poettering
Browse files

util: properly detect ttyname_r() failing

parent 11620592
......@@ -2531,11 +2531,12 @@ char* getlogname_malloc(void) {
int getttyname_malloc(char **r) {
char path[PATH_MAX], *p, *c;
int k;
assert(r);
if (ttyname_r(STDIN_FILENO, path, sizeof(path)) < 0)
return -errno;
if ((k = ttyname_r(STDIN_FILENO, path, sizeof(path))) != 0)
return -k;
char_array_0(path);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment