t/nntpd.t | 3 ++- diff --git a/t/nntpd.t b/t/nntpd.t index 527cfc2c2f4d9cf65dc724a9c3425a8261d43892..d30ed63f9fb04baf4c66d93adec93854465354b4 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -44,7 +44,6 @@ Type => SOCK_STREAM, Listen => 1024, ); my $sock = IO::Socket::INET->new(%opts); -plan skip_all => 'sock fd!=3, cannot test nntpd integration' if fileno($sock) != 3; my $pid; END { kill 'TERM', $pid if defined $pid }; { @@ -78,8 +77,10 @@ ok(! $!, 'no error from fcntl(F_GETFD)'); is($fl, FD_CLOEXEC, 'cloexec set by default (Perl behavior)'); $pid = fork; if ($pid == 0) { + use POSIX qw(dup2); # pretend to be systemd fcntl($sock, F_SETFD, $fl &= ~FD_CLOEXEC); + dup2(fileno($sock), 3) or die "dup2 failed: $!\n"; $ENV{LISTEN_PID} = $$; $ENV{LISTEN_FDS} = 1; exec $nntpd, "--stdout=$out", "--stderr=$err";