Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 11 Jul 2014 21:15:17 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] implement the LOG_PERROR option in syslog

On Fri, Jul 11, 2014 at 08:55:25PM -0400, Rich Felker wrote:
> On Fri, Jul 11, 2014 at 12:49:50AM -0400, Rich Felker wrote:
> > Anyway, for adding the feature you want, where you just want to know
> > the number of initial bytes to skip writing to stderr, I would just
> > use %n to get the offset.
> 
> Attached is a patch to do this. I'll commit it soon if nobody notices
> any problems right away.
> [...]
>  		else l += l2;
>  		if (buf[l-1] != '\n') buf[l++] = '\n';
>  		send(log_fd, buf, l, 0);
> +		if (log_opt & LOG_PERROR) write(2, buf+hlen, l-hlen);
>  	}

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.

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.