From: "Arsen Arsenović" <arsen@aarsen.me>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Ensure standard file descriptors are open on start
Date: Wed, 19 Aug 2020 00:31:39 +0200 [thread overview]
Message-ID: <20200818223139.mmo5ik5o5gvh4z6a@bstg> (raw)
In-Reply-To: <d9fd5083-d447-095f-bb36-f21b4ef49ddd@cs.ucla.edu>
[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]
> > - check_one_fd (STDIN_FILENO, O_WRONLY | O_NOFOLLOW);
> > - check_one_fd (STDOUT_FILENO, O_RDONLY | O_NOFOLLOW);
> > - check_one_fd (STDERR_FILENO, O_RDONLY | O_NOFOLLOW);
> > + check_one_fd (STDIN_FILENO, O_RDONLY | O_NOFOLLOW);
> > + check_one_fd (STDOUT_FILENO, O_WRONLY | O_NOFOLLOW);
> > + check_one_fd (STDERR_FILENO, O_WRONLY | O_NOFOLLOW);
>
> Why is this change needed? Even if ISO C requires that standard streams be
> open, it doesn't require that one can do I/O successfully with the streams.
It seems to me that the sanest option would be making all three file descriptors
read/wrote only (as appropriate), by opening /dev/null. This makes all reads
EOFs and all writes successful, which would be what, at least, I expect when
closing one of the standard streams.
Regardless, with and without this change, the configure script I mentioned still
runs fine (since the standard streams it rightfully assumes exist indeed do
exist), so I can remove it, if that's a better solution.
--
Arsen Arsenović
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-08-18 22:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-18 17:50 Arsen Arsenović
2020-08-18 20:11 ` Paul Eggert
2020-08-18 22:31 ` Arsen Arsenović [this message]
2020-08-18 22:37 ` Paul Eggert
2020-08-18 23:28 ` Arsen Arsenović
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200818223139.mmo5ik5o5gvh4z6a@bstg \
--to=arsen@aarsen.me \
--cc=eggert@cs.ucla.edu \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).