Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jan 2018 01:05:57 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328525 - head/contrib/tnftp/src
Message-ID:  <201801290105.w0T15vRR058629@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801290105.w0T15vRR058629>