From owner-svn-src-all@freebsd.org Mon Jan 29 01:05:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAF88ECA329; Mon, 29 Jan 2018 01:05:57 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B3BA77819; Mon, 29 Jan 2018 01:05:57 +0000 (UTC) (envelope-from pfg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7239E213F4; Mon, 29 Jan 2018 01:05:57 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0T15vD5058630; Mon, 29 Jan 2018 01:05:57 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0T15vRR058629; Mon, 29 Jan 2018 01:05:57 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801290105.w0T15vRR058629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 29 Jan 2018 01:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328525 - head/contrib/tnftp/src X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/contrib/tnftp/src X-SVN-Commit-Revision: 328525 X-SVN-Commit-Repository: base 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.25 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: Mon, 29 Jan 2018 01:05:58 -0000 Author: pfg Date: Mon Jan 29 01:05:57 2018 New Revision: 328525 URL: https://svnweb.freebsd.org/changeset/base/328525 Log: ftp(1): Use closefrom() instead of individual close()s. Use closefrom(3) instead of manually closing all file descriptors between 3 and 19. Obtained from: OpenBSD (CVS 1.80) Modified: head/contrib/tnftp/src/cmds.c Modified: head/contrib/tnftp/src/cmds.c ============================================================================== --- head/contrib/tnftp/src/cmds.c Mon Jan 29 00:22:30 2018 (r328524) +++ head/contrib/tnftp/src/cmds.c Mon Jan 29 01:05:57 2018 (r328525) @@ -1438,8 +1438,7 @@ shell(int argc, char *argv[]) } oldintr = xsignal(SIGINT, SIG_IGN); if ((pid = fork()) == 0) { - for (pid = 3; pid < 20; pid++) - (void)close(pid); + (void)closefrom(3); (void)xsignal(SIGINT, SIG_DFL); shellp = getenv("SHELL"); if (shellp == NULL)