From owner-svn-src-head@freebsd.org Tue Jun 27 13:24:07 2017 Return-Path: Delivered-To: svn-src-head@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 4AF48DAA8E5; Tue, 27 Jun 2017 13:24:07 +0000 (UTC) (envelope-from jwd@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 1BB51660C9; Tue, 27 Jun 2017 13:24:07 +0000 (UTC) (envelope-from jwd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5RDO61V014744; Tue, 27 Jun 2017 13:24:06 GMT (envelope-from jwd@FreeBSD.org) Received: (from jwd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5RDO63A014743; Tue, 27 Jun 2017 13:24:06 GMT (envelope-from jwd@FreeBSD.org) Message-Id: <201706271324.v5RDO63A014743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jwd set sender to jwd@FreeBSD.org using -f From: "John W. De Boskey" Date: Tue, 27 Jun 2017 13:24:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320406 - head/libexec/rshd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jun 2017 13:24:07 -0000 Author: jwd Date: Tue Jun 27 13:24:06 2017 New Revision: 320406 URL: https://svnweb.freebsd.org/changeset/base/320406 Log: A little tweak for performance Reviewed by: adrian Approved by: rmacklem (mentor) MFC after: 3 weeks Modified: head/libexec/rshd/rshd.c Modified: head/libexec/rshd/rshd.c ============================================================================== --- head/libexec/rshd/rshd.c Tue Jun 27 12:56:36 2017 (r320405) +++ head/libexec/rshd/rshd.c Tue Jun 27 13:24:06 2017 (r320406) @@ -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]; @@ -496,8 +496,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)