Author: asomers Date: Fri Nov 18 22:23:01 2016 New Revision: 308814 URL: https://svnweb.freebsd.org/changeset/base/308814
Log: MFC r307752 Close some file descriptor leaks in pw Modified: stable/10/usr.sbin/pw/grupd.c stable/10/usr.sbin/pw/pw_nis.c stable/10/usr.sbin/pw/pwupd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/grupd.c ============================================================================== --- stable/10/usr.sbin/pw/grupd.c Fri Nov 18 21:18:51 2016 (r308813) +++ stable/10/usr.sbin/pw/grupd.c Fri Nov 18 22:23:01 2016 (r308814) @@ -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 } 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()"); Modified: stable/10/usr.sbin/pw/pw_nis.c ============================================================================== --- stable/10/usr.sbin/pw/pw_nis.c Fri Nov 18 21:18:51 2016 (r308813) +++ stable/10/usr.sbin/pw/pw_nis.c Fri Nov 18 22:23:01 2016 (r308814) @@ -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 p } 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) Modified: stable/10/usr.sbin/pw/pwupd.c ============================================================================== --- stable/10/usr.sbin/pw/pwupd.c Fri Nov 18 21:18:51 2016 (r308813) +++ stable/10/usr.sbin/pw/pwupd.c Fri Nov 18 22:23:01 2016 (r308814) @@ -111,8 +111,10 @@ pw_update(struct passwd * pwd, char cons } if (pw_copy(pfd, tfd, pw, old_pw) == -1) { pw_fini(); + close(tfd); err(1, "pw_copy()"); } + close(tfd); /* * in case of deletion of a user, the whole database * needs to be regenerated _______________________________________________ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"