This means we can avoid false-positives when inheriting multiple
Unix domain sockets.
my ($s) = @_;
my $addr = getsockname($s) or return;
my ($host, $port) = host_with_port($addr);
+ if ($port == 0 && $host eq '127.0.0.1') {
+ my ($path) = Socket::sockaddr_un($addr);
+ return $path;
+ }
"$host:$port";
}
ok(defined $pid, 'forked httpd process successfully');
};
+{
+ require PublicInbox::Daemon;
+ my $l = "$tmpdir/named.sock";
+ my $s = IO::Socket::UNIX->new(Listen => 5, Local => $l,
+ Type => SOCK_STREAM);
+ is(PublicInbox::Daemon::sockname($s), $l, 'sockname works for UNIX');
+}
+
ok(!-S $unix, 'UNIX socket does not exist, yet');
$spawn_httpd->("-l$unix");
for (1..1000) {