From 236ac082c904f8d71525f142e06230000f8bb79e Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Mon, 14 Nov 2022 22:27:28 -0600 Subject: [PATCH] Improve error handling when running gpgv This commit harmonizes the exit status used when the child process fails to exec gpgv with that used by posix_spawn, and ensures that the child process is reaped when the exec fails. --- gatekeeper.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index 7afb0e0..e0a0928 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -914,7 +914,7 @@ sub _spawn_gpgv { close $gpgv_status; close $gpgv_flag; our $AbortPipe = $gpgv_flag_sink; # pipe to parent - our $AbortExitCode = 120; # arbitrary 7-bit exit code + our $AbortExitCode = 127; # as posix_spawn uses # no need to use local here; this process will either exec or abort # Adjust close-on-exec flags: @@ -955,6 +955,7 @@ sub _spawn_gpgv { chomp $err; if ($err =~ m/^ERR: (.*)$/) { # This is bad - we couldn't even execute the gpgv command properly + waitpid $pid, 0; # reap failed child ftp_abort ("gpg verify of directive file failed (error executing gpgv): $1"); } -- 2.25.1