From owner-svn-src-all@freebsd.org Fri Nov 18 22:28:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EE51C4883F; Fri, 18 Nov 2016 22:28:59 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C88991BF0; Fri, 18 Nov 2016 22:28:58 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAIMSvtK016907; Fri, 18 Nov 2016 22:28:57 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAIMSvxK016904; Fri, 18 Nov 2016 22:28:57 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201611182228.uAIMSvxK016904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 18 Nov 2016 22:28:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r308815 - stable/11/usr.sbin/pw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2016 22:28:59 -0000 Author: asomers Date: Fri Nov 18 22:28:57 2016 New Revision: 308815 URL: https://svnweb.freebsd.org/changeset/base/308815 Log: MFC r307752 Close some file descriptor leaks in pw Modified: stable/11/usr.sbin/pw/grupd.c stable/11/usr.sbin/pw/pw_nis.c stable/11/usr.sbin/pw/pwupd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pw/grupd.c ============================================================================== --- stable/11/usr.sbin/pw/grupd.c Fri Nov 18 22:23:01 2016 (r308814) +++ stable/11/usr.sbin/pw/grupd.c Fri Nov 18 22:28:57 2016 (r308815) @@ -34,6 +34,7 @@ static const char rcsid[] = #include #include #include +#include #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/11/usr.sbin/pw/pw_nis.c ============================================================================== --- stable/11/usr.sbin/pw/pw_nis.c Fri Nov 18 22:23:01 2016 (r308814) +++ stable/11/usr.sbin/pw/pw_nis.c Fri Nov 18 22:28:57 2016 (r308815) @@ -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 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/11/usr.sbin/pw/pwupd.c ============================================================================== --- stable/11/usr.sbin/pw/pwupd.c Fri Nov 18 22:23:01 2016 (r308814) +++ stable/11/usr.sbin/pw/pwupd.c Fri Nov 18 22:28:57 2016 (r308815) @@ -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