From 2ea979f43ec87547b7dfb74312a21062044d018a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 5 Mar 2016 22:42:16 +0000 Subject: daemon: sockname detects listeners correctly This means we can avoid false-positives when inheriting multiple Unix domain sockets. --- t/httpd-unix.t | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't') diff --git a/t/httpd-unix.t b/t/httpd-unix.t index b3368491..13df676b 100644 --- a/t/httpd-unix.t +++ b/t/httpd-unix.t @@ -35,6 +35,14 @@ my $spawn_httpd = sub { 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) { -- cgit v1.2.3-24-ge0c7