about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-02-02 17:51:26 +0000
committerEric Wong <e@yhbt.net>2020-02-02 17:51:39 +0000
commite95b4225b32cd561e608e3b9740024ed66fe7b0f (patch)
tree3a468785da4c48bfe963f440bbdec80eccdd02f3
parent5bddb0ece15079f9961949d48615b990081e0a95 (diff)
downloadpublic-inbox-e95b4225b32cd561e608e3b9740024ed66fe7b0f.tar.gz
Commit 9f5a583694396f84 ("spawn (and thus popen_rd) die on failure")
was incomplete in that it only removed error checking for spawn
failures for non-(vfork|fork) calls, but the actual (vfork|fork)
PID result could still be undef.

Fixes: 9f5a583694396f84 ("spawn (and thus popen_rd) die on failure")
-rw-r--r--lib/PublicInbox/Spawn.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm
index b02d5368..727caf1c 100644
--- a/lib/PublicInbox/Spawn.pm
+++ b/lib/PublicInbox/Spawn.pm
@@ -210,7 +210,8 @@ sub spawn ($;$$) {
         }
         my $cd = $opts->{'-C'} // ''; # undef => NULL mapping doesn't work?
         my $pid = pi_fork_exec($redir, $f, $cmd, \@env, $rlim, $cd);
-        $pid < 0 ? undef : $pid;
+        die "fork_exec failed: $!\n" unless defined $pid;
+        $pid;
 }
 
 sub popen_rd {