about summary refs log tree commit homepage
path: root/lib/PublicInbox/XapHelper.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-17 23:37:56 +0000
committerEric Wong <e@80x24.org>2023-10-18 20:50:27 +0000
commit2f8cbc7c4a5b5e328c2e6adeae4f320a08c5321a (patch)
treee9d4f77b9becf317ca5be453abadd905d2cdcdf5 /lib/PublicInbox/XapHelper.pm
parente029ce7fd62de79e57e665e19f25c7ae1a94dcc7 (diff)
downloadpublic-inbox-2f8cbc7c4a5b5e328c2e6adeae4f320a08c5321a.tar.gz
Only caveat is we can't use bareword filehandles, but that's
a minor inconvenience.
Diffstat (limited to 'lib/PublicInbox/XapHelper.pm')
-rw-r--r--lib/PublicInbox/XapHelper.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/XapHelper.pm b/lib/PublicInbox/XapHelper.pm
index c31fe9a2..eea10a44 100644
--- a/lib/PublicInbox/XapHelper.pm
+++ b/lib/PublicInbox/XapHelper.pm
@@ -13,11 +13,11 @@ use PublicInbox::IPC;
 use PublicInbox::Git qw(read_all);
 use Socket qw(SOL_SOCKET SO_TYPE SOCK_SEQPACKET AF_UNIX);
 use PublicInbox::DS qw(awaitpid);
-use autodie qw(open);
+use autodie qw(open getsockopt);
 use POSIX qw(:signal_h);
 use Fcntl qw(LOCK_UN LOCK_EX);
 my $X = \%PublicInbox::Search::X;
-our (%SRCH, %WORKERS, $alive, $nworker, $workerset);
+our (%SRCH, %WORKERS, $alive, $nworker, $workerset, $in);
 our $stderr = \*STDERR;
 
 # only short options for portability in C++ implementation
@@ -176,7 +176,6 @@ sub dispatch {
 sub recv_loop {
         local $SIG{__WARN__} = sub { print $stderr @_ };
         my $rbuf;
-        my $in = \*STDIN;
         local $SIG{TERM} = sub { undef $in };
         while (defined($in)) {
                 PublicInbox::DS::sig_setmask($workerset);
@@ -247,7 +246,7 @@ sub xh_alive { $alive || scalar(keys %WORKERS) }
 
 sub start (@) {
         my (@argv) = @_;
-        my $c = getsockopt(STDIN, SOL_SOCKET, SO_TYPE) or die "getsockopt: $!";
+        my $c = getsockopt($in = \*STDIN, SOL_SOCKET, SO_TYPE);
         unpack('i', $c) == SOCK_SEQPACKET or die 'stdin is not SOCK_SEQPACKET';
 
         local (%SRCH, %WORKERS);