]> xenbits.xensource.com Git - osstest.git/commitdiff
power: Fix uninitialised variable warning
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 2 Apr 2019 14:56:57 +0000 (15:56 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 2 Apr 2019 15:11:20 +0000 (16:11 +0100)
In
  power: Record approach used for power cycles in runvars
we introduced a reference to $r{$rv} which might be undef,
resulting in this:
  Use of uninitialized value in concatenation (.) or string at Osstest/TestSupport.pm line 1069.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest/TestSupport.pm

index 334cc2cb7d02f9e0fe9fdfe84e5b6181dc173759..d35a784bb0b4f7dcebf5626e6a7828924b47a645 100644 (file)
@@ -1023,7 +1023,7 @@ sub power_reboot_attempts ($$$;$$) {
            logm("power: rebooted $ho->{Name} (using $approach->{Name})");
            if (defined $record_runvar_tail) {
                my $rv = "$ho->{Ident}_power_${record_runvar_tail}";
-               my $newval = $r{$rv}.(!!length($r{$rv}) and ',')
+               my $newval = ($r{$rv} // '').(!!length($r{$rv}) and ',')
                    .$approach->{Name};
                store_runvar($rv, $newval);
            }