From owner-freebsd-hackers@freebsd.org Sat Jan 6 01:11:03 2018 Return-Path: Delivered-To: freebsd-hackers@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 D1647EABE63 for ; Sat, 6 Jan 2018 01:11:03 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (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 B32926988B for ; Sat, 6 Jan 2018 01:11:03 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 6859a23e-f27e-11e7-8486-0934409070aa X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 6859a23e-f27e-11e7-8486-0934409070aa; Sat, 06 Jan 2018 01:10:39 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w061AtIH002449; Fri, 5 Jan 2018 18:10:55 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1515201055.1865.5.camel@freebsd.org> Subject: Re: Is it considered to be ok to not check the return code of close(2) in base? From: Ian Lepore To: cem@freebsd.org, Poul-Henning Kamp Cc: Freebsd hackers list Date: Fri, 05 Jan 2018 18:10:55 -0700 In-Reply-To: References: <24acbd94-c52f-e71a-8a96-d608a10963c6@rawbw.com> <1514572041.12000.7.camel@freebsd.org> <20180105221330.GD95035@spindle.one-eyed-alien.net> <24173.1515191675@critter.freebsd.dk> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jan 2018 01:11:03 -0000 On Fri, 2018-01-05 at 15:17 -0800, Conrad Meyer wrote: > On Fri, Jan 5, 2018 at 2:34 PM, Poul-Henning Kamp > wrote: > > > > Brookes suggestion, while well intentioned, wouldn't get very far, > > because it is common for shells and shell-like programs to do: > > > >         for (i = 3; i < ALOT; i++) > >                 (void)close(i); > > > > To get rid of unwanted filedescriptors from syslog(3), getpwent(3) > > etc. > > in the child process. > > > > Yes, I know about closefrom(2), but a lot of programs still don't > > use it. > Hi, > > That seems like a good way to quickly identify programs in base that > still do not use closefrom(). > > Best, > Conrad > Portable programs MUST iterate 3-ALOT, because closefrom() is not available in linux and other OSes. -- Ian