Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 6 Jul 2015 19:15:18 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] close syslog socket on error to recreate it later

On Sun, Jul 05, 2015 at 07:57:21PM +0200, Laurent Bercot wrote:
> On 05/07/2015 19:18, Rich Felker wrote:
> >This may be okay, but are there possibly errors which are transient
> >and do not indicate a broken connection? EINTR comes to mind. I wonder
> >if the close logic should be default on any error but known-transient
> >ones (EINTR only?) or if it should only be done on EPIPE or whatever
> >error we get when the other end of the socket was closed.
> 
>  The problem is that syslog() does not return an error code, so how
> would you treat transient errors?

If LOG_CONS is set, they're handled by sending the message to the
console instead of syslogd.

>  In any case, I think it's a good idea to use MSG_NOSIGNAL in the
> send().

That's done. While there are other more general ways to avoid SIGPIPE,
MSG_NOSIGNAL is the easiest and least costly when it works. But I
don't think datagram socket sends can result in EPIPE/SIGPIPE anyway.

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.