diff options
author | Alan Somers <asomers@FreeBSD.org> | 2016-10-21 20:17:19 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2016-10-21 20:17:19 +0000 |
commit | b740a3ee5598c5dd5baf65ca8dfec07737ec3e70 (patch) | |
tree | 2a9b8262a5f149c3de7d78e6299293515d0004b4 /pw/pw_nis.c | |
parent | e45ac3a61a1794763ce55802142df6c74cbb6723 (diff) | |
download | pw-darwin-b740a3ee5598c5dd5baf65ca8dfec07737ec3e70.tar.gz pw-darwin-b740a3ee5598c5dd5baf65ca8dfec07737ec3e70.tar.zst pw-darwin-b740a3ee5598c5dd5baf65ca8dfec07737ec3e70.zip |
Close some file descriptor leaks in pw
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8245
Diffstat (limited to 'pw/pw_nis.c')
-rw-r--r-- | pw/pw_nis.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pw/pw_nis.c b/pw/pw_nis.c index 6cc361b..35b26ea 100644 --- a/pw/pw_nis.c +++ b/pw/pw_nis.c @@ -34,6 +34,7 @@ static const char rcsid[] = #include <err.h> #include <pwd.h> #include <libutil.h> +#include <unistd.h> #include "pw.h" @@ -63,8 +64,10 @@ pw_nisupdate(const char * path, struct passwd * pwd, char const * user) } if (pw_copy(pfd, tfd, pw, old_pw) == -1) { pw_fini(); + close(tfd); err(1, "pw_copy()"); } + close(tfd); if (chmod(pw_tempname(), 0644) == -1) err(1, "chmod()"); if (rename(pw_tempname(), path) == -1) |