Skip to content

dist/IO: Set io_socket_peername during configure() of a Unix socket#24273

Open
mbanck wants to merge 1 commit intoPerl:bleadfrom
mbanck:gh-24195-2
Open

dist/IO: Set io_socket_peername during configure() of a Unix socket#24273
mbanck wants to merge 1 commit intoPerl:bleadfrom
mbanck:gh-24195-2

Conversation

@mbanck
Copy link
Copy Markdown

@mbanck mbanck commented Mar 14, 2026

Some systems (notably GNU/Hurd) do not support getpeername() on a local Unix socket, which breaks read() on them as it tries to set the peer if there is none already. In order to circumvent that, set the peer during configure(), where it is known.

Fixes #24195

This is an alternative (and probably superior) approach to #24201 . In general, both could be applied, but either works for fixing #24195

Some systems (notably GNU/Hurd) do not support getpeername() on a local Unix
socket, which breaks read() on them as it tries to set the peer if there is
none already. In order to circumvent that, set the peer during configure(),
where it is known.

Fixes Perl#24195
}
elsif(exists $arg->{Peer}) {
my $addr = sockaddr_un($arg->{Peer});
${*$sock}{'io_socket_peername'} = $arg->{Peer};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect, it should be a sockaddr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IO::Socket.pm send() fails for unix sockets on the Hurd as getpeername() is a stub

2 participants