summaryrefslogtreecommitdiff
path: root/usr.bin/passwd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:35:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:35:06 +0000
commit61656abc7ff84215165af1bd464bc053b3b66158 (patch)
treec7eabb0c4fa9faa024e724e99c240c40da07ca42 /usr.bin/passwd
parent18603ebf99fbb890ae9666cb0c4aa9f879e7edaa (diff)
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 'usr.bin/passwd')
-rw-r--r--usr.bin/passwd/local_passwd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/passwd/local_passwd.c b/usr.bin/passwd/local_passwd.c
index 5d1f4ce0223..a9aa2318d2f 100644
--- a/usr.bin/passwd/local_passwd.c
+++ b/usr.bin/passwd/local_passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: local_passwd.c,v 1.55 2018/11/08 15:41:41 mestre Exp $ */
+/* $OpenBSD: local_passwd.c,v 1.56 2019/06/28 13:35:02 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -147,13 +147,13 @@ local_passwd(char *uname, int authenticated)
if (i >= 4)
fputc('\n', stderr);
pfd = open(_PATH_MASTERPASSWD, O_RDONLY | O_CLOEXEC, 0);
- if (pfd < 0)
+ if (pfd == -1)
pw_error(_PATH_MASTERPASSWD, 1, 1);
/* Update master.passwd file and rebuild spwd.db. */
pw_copy(pfd, tfd, pw, opw);
free(opw);
- if (pw_mkdb(uname, pwflags) < 0)
+ if (pw_mkdb(uname, pwflags) == -1)
pw_error(NULL, 0, 1);
return(0);