Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jan 2018 15:17:31 -0800
From:      Conrad Meyer <cem@freebsd.org>
To:        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:  <CAG6CVpULXoq6w4Xb%2BiSJ08phFuiCPhEod25Y4Am5PN9R=R5iZQ@mail.gmail.com>
In-Reply-To: <24173.1515191675@critter.freebsd.dk>
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>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpULXoq6w4Xb%2BiSJ08phFuiCPhEod25Y4Am5PN9R=R5iZQ>