From b740a3ee5598c5dd5baf65ca8dfec07737ec3e70 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 21 Oct 2016 20:17:19 +0000 Subject: Close some file descriptor leaks in pw MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8245 --- pw/pw_nis.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pw/pw_nis.c') 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 #include #include +#include #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) -- cgit v1.2.3-56-ge451