about summary refs log tree commit homepage
path: root/lib/PublicInbox/Syscall.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Syscall.pm')
-rw-r--r--lib/PublicInbox/Syscall.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/PublicInbox/Syscall.pm b/lib/PublicInbox/Syscall.pm
index 0a0912fb..776fbe23 100644
--- a/lib/PublicInbox/Syscall.pm
+++ b/lib/PublicInbox/Syscall.pm
@@ -444,7 +444,10 @@ no warnings 'once';
                         msg_controllen,
                         0); # msg_flags
         my $r = syscall($SYS_recvmsg, fileno($sock), $mh, 0);
-        return (undef) if $r < 0; # $! set
+        if ($r < 0) { # $! is set
+                $_[1] = '';
+                return (undef);
+        }
         substr($_[1], $r, length($_[1]), '');
         my @ret;
         if ($r > 0) {