]> Sergey Matveev's repositories - public-inbox.git/commitdiff
daemon: simplify socket inheriting, slightly
authorEric Wong <e@80x24.org>
Fri, 4 Mar 2016 01:00:26 +0000 (01:00 +0000)
committerEric Wong <e@80x24.org>
Fri, 4 Mar 2016 01:04:08 +0000 (01:04 +0000)
IO::Handle->new_from_fd has existed since at least 1996,
so it should be safe to depend on at this point.

lib/PublicInbox/Daemon.pm

index 9f33c05af5c6bb0e2066970f72121e359a30d2b1..f0be034c57ef8054f65ac5bf374b61c71d599b4a 100644 (file)
@@ -206,8 +206,7 @@ sub inherit () {
        my $end = $fds + 2; # LISTEN_FDS_START - 1
        my @rv = ();
        foreach my $fd (3..$end) {
-               my $s = IO::Handle->new;
-               $s->fdopen($fd, 'r');
+               my $s = IO::Handle->new_from_fd($fd, 'r');
                if (my $k = sockname($s)) {
                        $listener_names{$k} = $s;
                        push @rv, $s;