The <EXPR> perlop, `readline', and `read' functions will all retry on EINTR, so there's no need to retry and loop ourselves with `sysread'. --- lib/PublicInbox/Spamcheck/Spamc.pm | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/lib/PublicInbox/Spamcheck/Spamc.pm b/lib/PublicInbox/Spamcheck/Spamc.pm index b6098669..3ba2c3c9 100644 --- a/lib/PublicInbox/Spamcheck/Spamc.pm +++ b/lib/PublicInbox/Spamcheck/Spamc.pm @@ -23,19 +23,11 @@ sub spamcheck { my $rdr = { 0 => _msg_to_fh($self, $msg) }; my ($fh, $pid) = popen_rd($self->{checkcmd}, undef, $rdr); - my $r; unless (ref $out) { my $buf = ''; $out = \$buf; } -again: - do { - $r = sysread($fh, $$out, 65536, length($$out)); - } while (defined($r) && $r != 0); - unless (defined $r) { - goto again if $!{EINTR}; - die "read failed: $!"; - } + $$out = do { local $/; <$fh> }; close $fh or die "close failed: $!"; waitpid($pid, 0); ($? || $$out eq '') ? 0 : 1; -- unsubscribe: one-click, see List-Unsubscribe header archive: https://public-inbox.org/meta/