Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sat, 12 Jul 2014 09:58:34 -0400
From: Rich Felker <>
Subject: Re: [PATCH] implement the LOG_PERROR option in syslog

On Sat, Jul 12, 2014 at 09:33:21AM +0100, Laurent Bercot wrote:
> On 12/07/2014 02:15, Rich Felker wrote:
> >I think I'll change this to dprintf. Using a single write like this
> >without looping on partial writes is not guaranteed to work. dprintf
> >is overkill, but we pull in the printf framework anyway so it doesn't
> >hurt to use it.
>  Don't you have a wrapper for write() that loops around partial writes
> without pulling in printf ? I'd have thought it was needed in more than
> one place in the libc,

So far none have come up. There's very little code in libc that writes
to files. A few places (dns, syslog) write to sockets, but they use
send on datagram sockets in a manner where success or failure has to
be atomic (you can't retry on partial write with datagrams). There are
also a couple of places (posix_spawn comes to mind) that write to
internal pipes, but the same applies: writes < PIPE_BUF are atomic.

Anyway, actually it would be a good idea to check for invalid uses of
read or write without retry in musl, but I doubt there are any serious
ones left.

> stdio being only one of them.

stdio uses writev in a more complex way that doesn't easily generalize
to generic usage like this, since it's working with both a FILE buffer
and a secondary buffer provided by the caller.


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.