From: Thomas Lamprecht Date: Wed, 5 Apr 2017 09:35:53 +0000 (+0200) Subject: run_command: default exit code to -1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=38d9aa124702d61eed5a3b4d054e5a17e64110ef;hp=86b8423739ccac26a115625bc002d6ef51d17a52;p=pve-common.git run_command: default exit code to -1 When the child process running the command got an signal or failed to execute exitcode was still undefined as we extract it just only after the signal/failed to execute check. This led to: > Use of uninitialized value in numeric ne (!=) at > /usr/share/perl5/PVE/API2/Qemu.pm line 1433. errors if we used run_commands `noerr` param and checked for the commands exit code. So just default the exit code to -1 for such cases. Signed-off-by: Thomas Lamprecht --- diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index 2cd4733..1f0ec75 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -341,7 +341,7 @@ sub run_command { my $timeout; my $oldtimeout; my $pid; - my $exitcode; + my $exitcode = -1; my $outfunc; my $errfunc;