about summary refs log tree commit homepage
path: root/lib/PublicInbox/LEI.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-01-24 04:46:49 -0700
committerEric Wong <e@80x24.org>2021-01-24 15:45:22 -0400
commitc80fc47e280a500ff8d6c3fde53e7554272e749b (patch)
tree00a9f9027eacd57affa16a2c617a470f14556a72 /lib/PublicInbox/LEI.pm
parent509c88ddfe0bb3bf4f00ff119eb2d847512df90c (diff)
downloadpublic-inbox-c80fc47e280a500ff8d6c3fde53e7554272e749b.tar.gz
Just open every FD as read/write.  Perl (or any non-broken
runtime) won't care and won't attempt to use F_SETFL to alter
file description flags; as attempting to change those would
lead to unpleasant side effects if the file description is
shared with another process.
Diffstat (limited to 'lib/PublicInbox/LEI.pm')
-rw-r--r--lib/PublicInbox/LEI.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index a9123c6e..473a28a9 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -765,11 +765,10 @@ sub accept_dispatch { # Listener {post_accept} callback
                 return send($sock, 'timed out waiting to recv FDs', MSG_EOR);
         my @fds = $recv_cmd->($sock, my $buf, 4096 * 33); # >MAX_ARG_STRLEN
         if (scalar(@fds) == 4) {
-                my $i = 0;
-                for my $rdr (qw(<&= >&= >&= <&=)) {
+                for my $i (0..3) {
                         my $fd = shift(@fds);
-                        open($self->{$i++}, $rdr, $fd) and next;
-                        send($sock, "open($rdr$fd) (FD=$i): $!", MSG_EOR);
+                        open($self->{$i}, '+<&=', $fd) and next;
+                        send($sock, "open(+<&=$fd) (FD=$i): $!", MSG_EOR);
                 }
         } else {
                 return send($sock, "recv_cmd failed: $!", MSG_EOR);