diff options
author | 2019-06-28 13:32:41 +0000 | |
---|---|---|
committer | 2019-06-28 13:32:41 +0000 | |
commit | df69c215c7c66baf660f3f65414fd34796c96152 (patch) | |
tree | 0255639162b24c4a2f761a274e32b69c2256fd45 /lib/libc/gen/authenticate.c | |
parent | miniroot prototype disklabels should attempt to contain accurate (diff) | |
download | wireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.tar.xz wireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.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 'lib/libc/gen/authenticate.c')
-rw-r--r-- | lib/libc/gen/authenticate.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/authenticate.c b/lib/libc/gen/authenticate.c index f1373694d58..fb96881832f 100644 --- a/lib/libc/gen/authenticate.c +++ b/lib/libc/gen/authenticate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: authenticate.c,v 1.26 2016/05/26 15:51:37 millert Exp $ */ +/* $OpenBSD: authenticate.c,v 1.27 2019/06/28 13:32:41 deraadt Exp $ */ /*- * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. @@ -164,7 +164,7 @@ auth_cat(char *file) int fd, nchars; char tbuf[8192]; - if ((fd = open(file, O_RDONLY, 0)) < 0) + if ((fd = open(file, O_RDONLY, 0)) == -1) return (0); while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0) (void)write(fileno(stdout), tbuf, nchars); @@ -282,7 +282,7 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type) pwd->pw_dir[0]) { struct stat sb; - if (stat(pwd->pw_dir, &sb) < 0 || !S_ISDIR(sb.st_mode) || + if (stat(pwd->pw_dir, &sb) == -1 || !S_ISDIR(sb.st_mode) || (pwd->pw_uid && sb.st_uid == pwd->pw_uid && (sb.st_mode & S_IXUSR) == 0)) { auth_setstate(as, (auth_getstate(as) & ~AUTH_ALLOW)); |