summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/ruserok.c
diff options
context:
space:
mode:
authorderaadt <>2019-06-28 13:35:02 +0000
committerderaadt <>2019-06-28 13:35:02 +0000
commit6585927e66d9ab172754d95c4296dd4309a40512 (patch)
treebc969c069c7b769f2601db17f08bec99274202a5 /src/lib/libc/net/ruserok.c
parent74ff76124ba7a371400a9f60d5e33192a3732f03 (diff)
downloadopenbsd-6585927e66d9ab172754d95c4296dd4309a40512.tar.gz
openbsd-6585927e66d9ab172754d95c4296dd4309a40512.tar.bz2
openbsd-6585927e66d9ab172754d95c4296dd4309a40512.zip
When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
Diffstat (limited to 'src/lib/libc/net/ruserok.c')
-rw-r--r--src/lib/libc/net/ruserok.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libc/net/ruserok.c b/src/lib/libc/net/ruserok.c
index cab6f96449..a399c013e2 100644
--- a/src/lib/libc/net/ruserok.c
+++ b/src/lib/libc/net/ruserok.c
@@ -131,11 +131,11 @@ again:
131 * user or root or if writeable by anyone but the owner, quit. 131 * user or root or if writeable by anyone but the owner, quit.
132 */ 132 */
133 cp = NULL; 133 cp = NULL;
134 if (lstat(pbuf, &sbuf) < 0) 134 if (lstat(pbuf, &sbuf) == -1)
135 cp = ".rhosts lstat failed"; 135 cp = ".rhosts lstat failed";
136 else if (!S_ISREG(sbuf.st_mode)) 136 else if (!S_ISREG(sbuf.st_mode))
137 cp = ".rhosts not regular file"; 137 cp = ".rhosts not regular file";
138 else if (fstat(fileno(hostf), &sbuf) < 0) 138 else if (fstat(fileno(hostf), &sbuf) == -1)
139 cp = ".rhosts fstat failed"; 139 cp = ".rhosts fstat failed";
140 else if (sbuf.st_uid && sbuf.st_uid != pwd->pw_uid) 140 else if (sbuf.st_uid && sbuf.st_uid != pwd->pw_uid)
141 cp = "bad .rhosts owner"; 141 cp = "bad .rhosts owner";