summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index bc227f52d5..3bcce2f019 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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);