summaryrefslogtreecommitdiffstats
path: root/usr.bin/chpass
diff options
context:
space:
mode:
authorokan <okan@openbsd.org>2013-04-18 16:23:25 +0000
committerokan <okan@openbsd.org>2013-04-18 16:23:25 +0000
commitb61bdfe07813cdf6185e963bf24efc9ba08876c3 (patch)
tree0aa2517cd1fe7c144aeb81d2ab2d3460284d2e36 /usr.bin/chpass
parentimprove time_t handling here, too (diff)
downloadwireguard-openbsd-b61bdfe07813cdf6185e963bf24efc9ba08876c3.tar.xz
wireguard-openbsd-b61bdfe07813cdf6185e963bf24efc9ba08876c3.zip
- use FD_CLOEXEC instead of 1
- use O_CLOEXEC with open() instead of open/fcntl from David Hill ok otto@
Diffstat (limited to 'usr.bin/chpass')
-rw-r--r--usr.bin/chpass/chpass.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/chpass/chpass.c b/usr.bin/chpass/chpass.c
index 516ef7d5e27..24f2eebc6a8 100644
--- a/usr.bin/chpass/chpass.c
+++ b/usr.bin/chpass/chpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chpass.c,v 1.38 2012/06/20 21:32:27 schwarze Exp $ */
+/* $OpenBSD: chpass.c,v 1.39 2013/04/18 16:23:25 okan Exp $ */
/* $NetBSD: chpass.c,v 1.8 1996/05/15 21:50:43 jtc Exp $ */
/*-
@@ -168,7 +168,7 @@ main(int argc, char *argv[])
if ((pw = pw_dup(pw)) == NULL)
pw_error(NULL, 1, 1);
dfd = mkstemp(tempname);
- if (dfd == -1 || fcntl(dfd, F_SETFD, 1) == -1)
+ if (dfd == -1 || fcntl(dfd, F_SETFD, FD_CLOEXEC) == -1)
pw_error(tempname, 1, 1);
display(tempname, dfd, pw);
edit_status = edit(tempname, pw);
@@ -216,8 +216,8 @@ main(int argc, char *argv[])
}
if (i >= 4)
fputc('\n', stderr);
- pfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
- if (pfd == -1 || fcntl(pfd, F_SETFD, 1) == -1)
+ pfd = open(_PATH_MASTERPASSWD, O_RDONLY|O_CLOEXEC, 0);
+ if (pfd == -1)
pw_error(_PATH_MASTERPASSWD, 1, 1);
#ifdef YP