GNU bug report logs - #33965
handling of closed file descriptors

Previous Next

Package: diffutils;

Reported by: Bruno Haible <bruno <at> clisp.org>

Date: Thu, 3 Jan 2019 19:43:01 UTC

Severity: normal

Full log


Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bruno Haible <bruno <at> clisp.org>
To: bug-diffutils <at> gnu.org
Subject: Re: handling of closed file descriptors
Date: Thu, 03 Jan 2019 21:02:16 +0100
I wrote:
> the result of fcntl
> can apparently be used to distinguish the substitute file descriptor
> stuffed in by exec() from a regular open("/dev/null",O_RDONLY).

Note that the code works for STDIN_FILENO, where fcntl(...) is 5 in one case
and 0 in the other case, and we use FD_CLOEXEC = 1 to distinguish the two.
For STDOUT_FILENO, fcntl(...) would be 5 in one case and 1 in the other case,
and the flag which allows to distinguish the two cases (4) is not listed in
<sys/fcntl.h>, therefore likely is a kernel-private flag.

Bruno





This bug report was last modified 6 years and 160 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.