From 900cb902886ce7aa257b866bcf8380f1b935c64a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 30 Aug 2023 05:10:39 +0000 Subject: treewide: drop MSG_EOR with AF_UNIX+SOCK_SEQPACKET It's apparently not needed for AF_UNIX + SOCK_SEQPACKET as our receivers never check for MSG_EOR in "struct msghdr".msg_flags anyways. I don't believe POSIX is clear on the exact semantics of MSG_EOR on this socket type. This works around truncation problems on OpenBSD recvmsg when MSG_EOR is used by the sender. Link: https://marc.info/?i=20230826020759.M335788@dcvr --- script/lei | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'script') diff --git a/script/lei b/script/lei index 5feb7751..a77ea880 100755 --- a/script/lei +++ b/script/lei @@ -2,7 +2,7 @@ # Copyright (C) all contributors # License: AGPL-3.0+ use v5.12; -use Socket qw(AF_UNIX SOCK_SEQPACKET MSG_EOR pack_sockaddr_un); +use Socket qw(AF_UNIX SOCK_SEQPACKET pack_sockaddr_un); use PublicInbox::CmdIPC4; my $narg = 5; my $sock; @@ -109,9 +109,9 @@ open my $dh, '<', '.' or die "open(.) $!"; my $buf = join("\0", scalar(@ARGV), @ARGV); while (my ($k, $v) = each %ENV) { $buf .= "\0$k=$v" } $buf .= "\0\0"; -$send_cmd->($sock, [0, 1, 2, fileno($dh)], $buf, MSG_EOR) or die "sendmsg: $!"; -$SIG{TSTP} = sub { send($sock, 'STOP', MSG_EOR); kill 'STOP', $$ }; -$SIG{CONT} = sub { send($sock, 'CONT', MSG_EOR) }; +$send_cmd->($sock, [0, 1, 2, fileno($dh)], $buf, 0) or die "sendmsg: $!"; +$SIG{TSTP} = sub { send($sock, 'STOP', 0); kill 'STOP', $$ }; +$SIG{CONT} = sub { send($sock, 'CONT', 0) }; my $x_it_code = 0; while (1) { @@ -126,7 +126,7 @@ while (1) { } elsif ($buf eq '-WINCH') { kill($buf, @parent); # for MUA } elsif ($buf eq 'umask') { - send($sock, 'u'.pack('V', umask), MSG_EOR) or die "send: $!" + send($sock, 'u'.pack('V', umask), 0) or die "send: $!" } elsif ($buf =~ /\Ax_it ([0-9]+)\z/) { $x_it_code ||= $1 + 0; last; -- cgit v1.2.3-24-ge0c7