Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Jan 2018 18:10:55 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        cem@freebsd.org, Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        Freebsd hackers list <freebsd-hackers@freebsd.org>
Subject:   Re: Is it considered to be ok to not check the return code of close(2) in base?
Message-ID:  <1515201055.1865.5.camel@freebsd.org>
In-Reply-To: <CAG6CVpULXoq6w4Xb%2BiSJ08phFuiCPhEod25Y4Am5PN9R=R5iZQ@mail.gmail.com>
References:  <24acbd94-c52f-e71a-8a96-d608a10963c6@rawbw.com> <1514572041.12000.7.camel@freebsd.org> <CAOtMX2jSonHQ9xzVD3Q9XS2twBm_CT3Tquwn%2Bf6zmc7aV0QerQ@mail.gmail.com> <20180105221330.GD95035@spindle.one-eyed-alien.net> <24173.1515191675@critter.freebsd.dk> <CAG6CVpULXoq6w4Xb%2BiSJ08phFuiCPhEod25Y4Am5PN9R=R5iZQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2018-01-05 at 15:17 -0800, Conrad Meyer wrote:
> On Fri, Jan 5, 2018 at 2:34 PM, Poul-Henning Kamp <phk@phk.freebsd.dk
> > 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



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