From: Wolfgang Link Date: Tue, 5 Jun 2018 10:58:47 +0000 (+0200) Subject: fix #1792: Do not assign vars in conditional statement X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;ds=sidebyside;h=9de0505c772f7c382c82d9bfb170b3e0664af9ed;p=pve-container.git fix #1792: Do not assign vars in conditional statement If a variable is defined and assigned in a conditional statement, it is not defined behavior in Perl. For more inforamtion about this behavior see https://perldoc.perl.org/perlsyn.html#Statement-Modifiers "NOTE: The behaviour of a my, state, or our modified with a statement modifier conditional or loop construct (for example, my $x if ... ) is undefined. The value of the my variable may be undef, any previously assigned value, or possibly anything else. Don't rely on it. Future versions of perl might do something different from the version of perl you try it out on. Here be dragons." --- diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index bfca9c1..4be1579 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -1208,7 +1208,8 @@ sub mountpoint_mount { } my $readonly = $mountpoint->{ro}; - my @extra_opts = ('-o', $optstring) if $optstring; + my @extra_opts; + @extra_opts = ('-o', $optstring) if $optstring; if ($storage) {