Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 6 Nov 2020 16:44:20 -0500
From: Rich Felker <>
Subject: Re: Why connect() in syslog?

On Fri, Nov 06, 2020 at 08:30:50PM +0100, Markus Wichmann wrote:
> Hi all,
> I was reading musl's syslog source code today for unrelated reasons, and
> saw that it is using connect() to set the destination. And it has some
> code to deal with connection failures. But why? I see the syslog socket
> is a datagram socket, so I thought sendto() with destination address
> means the same thing as connect() and send(), with the difference that
> it is one less syscall that can fail and no connection errors to handle.
> I tried finding information about the semantics of connect() on a UNIX
> datagram socket, but failed to find anything useful.

It's there so the process can chroot, move into a namespace/container,
etc. after calling openlog without losing the ability to do logging.


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.