On Mon, Nov 27, 2023 at 07:32:57AM +0100, Otto Moerbeek wrote: > On Sun, Nov 26, 2023 at 07:12:47PM -0800, Dev Email wrote: > > > Ideally, OpenBSD would return the same output. > > > > >Fix: > > > > This could be fixed by returning the actual length of the socket address in > > the "len" variable > > > > in the "getsockname" function. > > > > > > I don't believe that dmesg is relevant for this bug; I can provide it if > > requested. > > > > I'm not 10%% convinced it is a bug, there's is something to be said > for setting len to sizeof(struct sockaddr_un). >
It's documented: "namelen indicates the amount of space pointed to by name, in bytes." So, yes, for AF_UNIX sockets it is sizeof(struct sockaddr_un). > getsockname is underspecified in Posix Unix domain sockets, the other > address families use fixed size structs. > > FreeBSD's man page even says it is unsupported for Unix domain > sockets. So I'm undecided, other devs might have stronger opinions. > > -Otto >