summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-11-30 23:45:31 +0100
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-12-01 00:14:28 +0100
commit27373e442747010dfc195296c0705f67e905a611 (patch)
tree2290c4e18a6b2c057011d7443cfe79de3493b24a /src/shared
parenta051da35ce96923e31a532c86a530bfd40d5dc76 (diff)
util.c: check if return value from ttyname_r is > 0 instead of != 0
We must return a negative error code from getttyname_malloc but that would not be the case if ttyname_r returned a negative value. ttyname_r should only return EBADF, ENOTTY, or ERANGE so it should be safe to change.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 38134ae521..206fc803d0 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2501,7 +2501,7 @@ int getttyname_malloc(int fd, char **r) {
assert(r);
k = ttyname_r(fd, path, sizeof(path));
- if (k != 0)
+ if (k > 0)
return -k;
char_array_0(path);