|
|
Message-ID: <20251114012134.GN1827@brightrain.aerifal.cx> Date: Thu, 13 Nov 2025 20:21:34 -0500 From: Rich Felker <dalias@...c.org> To: Demi Marie Obenour <demiobenour@...il.com> Cc: musl@...ts.openwall.com Subject: Re: fputs() et al do not return EBADF for read-only files On Thu, Nov 13, 2025 at 05:21:56PM -0500, Demi Marie Obenour wrote: > See https://github.com/systemd/systemd/pull/39721 which works around this. This is expected. Per ISO C, calling an output function on a stream not opened for output has undefined behavior. Performing an additional mode check in each putc operation would be relatively costly and unjustified. This is not an exceptional condition that can happen at runtime like out-of-memory, insufficient permission, missing file, etc. Attempting to perform output on an input stream or vice versa is purely a programming error and the buggy code should be fixed. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.