From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by sourceware.org (Postfix) with ESMTPS id 446A83858D37 for ; Tue, 18 Aug 2020 22:31:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 446A83858D37 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4BWQcw18p4zKmWH; Wed, 19 Aug 2020 00:31:44 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id 11grMGxrLudY; Wed, 19 Aug 2020 00:31:41 +0200 (CEST) Date: Wed, 19 Aug 2020 00:31:39 +0200 From: Arsen =?utf-8?Q?Arsenovi=C4=87?= To: Paul Eggert Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Ensure standard file descriptors are open on start Message-ID: <20200818223139.mmo5ik5o5gvh4z6a@bstg> References: <20200818175018.27213-1-arsen@aarsen.me> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4m5mck6l7urjhimb" Content-Disposition: inline In-Reply-To: X-MBO-SPAM-Probability: X-Rspamd-Score: -4.72 / 15.00 / 15.00 X-Rspamd-Queue-Id: 2FE9B389 X-Rspamd-UID: 96c20b X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_INFOUSMEBIZ, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2020 22:31:47 -0000 --4m5mck6l7urjhimb Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > - 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); >=20 > 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 stream= s. It seems to me that the sanest option would be making all three file descri= ptors 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. --=20 Arsen Arsenovi=C4=87 --4m5mck6l7urjhimb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEN603JsCUe+6MiEcuSj/KZcFT9D4FAl88VssACgkQSj/KZcFT 9D5GkAf/QQeYbfCPpkVejL8TtqNafM8j2WteZuNO88QuPrtbf60FevBwiLMYk2be 0/Yv41/74rx49M68HLIfVajZb3Akfd9H7DS1rfiE18/PtnC92vBHRkQ+HuFdulf3 FFaKi5ffFwIU/UUiEvllaNiNW0ShgxoX6rlHFQQu5mCdnqpNxCTNqR0QQ87IdjnX nKm42sIwWOIaZL1DGWobK51o7zyXbeBEkkvvnt91dlX5whpxjLWQP8KFREChmqMG vcypuioaGoA+t2AgD80tA99AcPV87iXN6aviqHLfdS2SD7ZPfC5V79Ll/h6Rca2Z rDkvt24tN5HpUqxlyL40YDCMS6eUzA== =JW1b -----END PGP SIGNATURE----- --4m5mck6l7urjhimb--