From 38d9aa124702d61eed5a3b4d054e5a17e64110ef Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 5 Apr 2017 11:35:53 +0200 Subject: [PATCH] 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 --- src/PVE/Tools.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;