Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 26 Jun 2020 07:14:00 +0200
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Subject: Re: errno not set to EBADF when reading from invalid
 descriptor

On Thu, Jun 25, 2020 at 11:38:04AM -0400, Rich Felker wrote:
> Note that there are lots of other reasons you can't safely use stdio
> read functions on a stream you don't know is suitable for it.
> Switching from writing to reading without a successful flush produces
> UB, and switching the other direction without a successful seek does,
> even if the FILE stream is open for both.
>
> Rich

So I can't actually use a FILE open for reading and writing that refers
to something non-seekable, like a serial line, to both read and write to
it? I mean, I suppose I could write something and then flush and stay in
read mode forever, but that is not really the nature of my application.
I suppose I'll just open the serial line twice.

Ciao,
Markus

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.