]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - pw/grupd.c
Close some file descriptor leaks in pw
[pw-darwin.git] / pw / grupd.c
index 9cbe0cb0b345814ee2299abfcc50e94423352d92..38d5e5bc956ce26b01dae3e2ca470e08132d485e 100644 (file)
@@ -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()");