about summary refs log tree commit homepage
path: root/lib/PublicInbox/Spawn.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-09-24 20:19:20 +0000
committerEric Wong <e@80x24.org>2023-09-24 23:14:20 +0000
commit1afb6f5133444bc53db047574d5142f85dfc2218 (patch)
tree3cb40ac3a069e76ee50dd90e508cb6d0431a0904 /lib/PublicInbox/Spawn.pm
parent9852f593c5e86ffad77b2558f5028fd8f13f2c21 (diff)
downloadpublic-inbox-1afb6f5133444bc53db047574d5142f85dfc2218.tar.gz
Handling this should be done at the lowest levels possible;
so away from higher-level lei code.
Diffstat (limited to 'lib/PublicInbox/Spawn.pm')
-rw-r--r--lib/PublicInbox/Spawn.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm
index ed698afc..2b84e2d5 100644
--- a/lib/PublicInbox/Spawn.pm
+++ b/lib/PublicInbox/Spawn.pm
@@ -259,10 +259,12 @@ void recv_cmd4(PerlIO *s, SV *buf, STRLEN n)
         msg.msg_controllen = CMSG_SPACE(SEND_FD_SPACE);
 
         i = recvmsg(PerlIO_fileno(s), &msg, 0);
-        if (i < 0)
-                Inline_Stack_Push(&PL_sv_undef);
-        else
+        if (i >= 0) {
                 SvCUR_set(buf, i);
+        } else {
+                Inline_Stack_Push(&PL_sv_undef);
+                SvCUR_set(buf, 0);
+        }
         if (i > 0 && cmsg.hdr.cmsg_level == SOL_SOCKET &&
                         cmsg.hdr.cmsg_type == SCM_RIGHTS) {
                 size_t len = cmsg.hdr.cmsg_len;