Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Mar 2018 10:35:00 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r330322 - stable/11/libexec/rshd
Message-ID:  <201803031035.w23AZ089030871@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Sat Mar  3 10:35:00 2018
New Revision: 330322
URL: https://svnweb.freebsd.org/changeset/base/330322

Log:
  MFC r320406:
  
  A little tweak for performance

Modified:
  stable/11/libexec/rshd/rshd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/rshd/rshd.c
==============================================================================
--- stable/11/libexec/rshd/rshd.c	Sat Mar  3 10:32:00 2018	(r330321)
+++ stable/11/libexec/rshd/rshd.c	Sat Mar  3 10:35:00 2018	(r330322)
@@ -191,7 +191,7 @@ doit(struct sockaddr *fromp)
 	struct passwd *pwd;
 	u_short port;
 	fd_set ready, readfrom;
-	int cc, fd, nfd, pv[2], pid, s;
+	int cc, nfd, pv[2], pid, s;
 	int one = 1;
 	const char *cp, *errorstr;
 	char sig, buf[BUFSIZ];
@@ -493,8 +493,7 @@ doit(struct sockaddr *fromp)
 #ifdef USE_BLACKLIST
 	blacklist(0, STDIN_FILENO, "success");
 #endif
-	for (fd = getdtablesize(); fd > 2; fd--)
-		(void) close(fd);
+	closefrom(3);
 	if (setsid() == -1)
 		syslog(LOG_ERR, "setsid() failed: %m");
 	if (setlogin(pwd->pw_name) < 0)



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