summaryrefslogtreecommitdiff
path: root/usr.bin/chpass
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-08-02 03:35:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-08-02 03:35:08 +0000
commite800444ce2f8026e59793866c970a20bba7aabd3 (patch)
tree7fd48a9cc3da420434cc0bd2c4fd3a147ac83f18 /usr.bin/chpass
parent087c4175e6eabb7c2705d3a302d30cdae858dbba (diff)
add close on exec flag to all opens
Diffstat (limited to 'usr.bin/chpass')
-rw-r--r--usr.bin/chpass/chpass.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/chpass/chpass.c b/usr.bin/chpass/chpass.c
index 7c61529880d..c1ac2e1067e 100644
--- a/usr.bin/chpass/chpass.c
+++ b/usr.bin/chpass/chpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chpass.c,v 1.11 1998/05/29 16:37:51 millert Exp $ */
+/* $OpenBSD: chpass.c,v 1.12 1998/08/02 03:35:07 millert Exp $ */
/* $NetBSD: chpass.c,v 1.8 1996/05/15 21:50:43 jtc Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: chpass.c,v 1.11 1998/05/29 16:37:51 millert Exp $";
+static char rcsid[] = "$OpenBSD: chpass.c,v 1.12 1998/08/02 03:35:07 millert Exp $";
#endif
#endif /* not lint */
@@ -181,20 +181,20 @@ main(argc, argv)
/* Get the passwd lock file and open the passwd file for reading. */
pw_init();
tfd = pw_lock(0);
- if (tfd < 0) {
+ if (tfd == -1 || fcntl(tfd, F_SETFD, 1) == -1) {
if (errno == EEXIST)
errx(1, "the passwd file is busy.");
else
err(1, "can't open passwd temp file");
}
pfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
- if (pfd < 0)
+ if (pfd == -1 || fcntl(pfd, F_SETFD, 1) == -1)
pw_error(_PATH_MASTERPASSWD, 1, 1);
/* Edit the user passwd information if requested. */
if (op == EDITENTRY) {
dfd = mkstemp(tempname);
- if (dfd < 0)
+ if (dfd == -1 || fcntl(dfd, F_SETFD, 1) == -1)
pw_error(tempname, 1, 1);
display(tempname, dfd, pw);
edit(tempname, pw);
@@ -217,7 +217,7 @@ main(argc, argv)
pw_copy(pfd, tfd, pw);
/* Now finish the passwd file update. */
- if (pw_mkdb() < 0)
+ if (pw_mkdb() == -1)
pw_error(NULL, 0, 1);
}