summaryrefslogtreecommitdiffstats
path: root/pw/grupd.c
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2016-10-21 20:17:19 +0000
committerAlan Somers <asomers@FreeBSD.org>2016-10-21 20:17:19 +0000
commitb740a3ee5598c5dd5baf65ca8dfec07737ec3e70 (patch)
tree2a9b8262a5f149c3de7d78e6299293515d0004b4 /pw/grupd.c
parente45ac3a61a1794763ce55802142df6c74cbb6723 (diff)
downloadpw-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/grupd.c')
-rw-r--r--pw/grupd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pw/grupd.c b/pw/grupd.c
index 9cbe0cb..38d5e5b 100644
--- a/pw/grupd.c
+++ b/pw/grupd.c
@@ -34,6 +34,7 @@ static const char rcsid[] =
#include <libutil.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#include "pwupd.h"
@@ -73,8 +74,10 @@ gr_update(struct group * grp, char const * group)
}
if (gr_copy(pfd, tfd, gr, old_gr) == -1) {
gr_fini();
+ close(tfd);
err(1, "gr_copy()");
}
+ close(tfd);
if (gr_mkdb() == -1) {
gr_fini();
err(1, "gr_mkdb()");