[pve-devel] [PATCH common v5 2/7] inotify: interfaces: check if bridge_vids is truthy instead of defined

Aaron Lauterer a.lauterer at proxmox.com
Wed Oct 2 15:11:52 CEST 2024


The old check for defined would also be true if it contained an empty
string. By checking its truthyness, an empty string will be falsy and
therefore the default value will be used.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
changes since:
v4: newly added

 src/PVE/INotify.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 8a4a810..d29e2a1 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -1315,7 +1315,7 @@ sub __interface_to_string {
 
 	if (defined($d->{bridge_vlan_aware})) {
 	    $raw .= "\tbridge-vlan-aware yes\n";
-	    my $vlans = defined($d->{bridge_vids}) ? $d->{bridge_vids} : "2-4094";
+	    my $vlans = $d->{bridge_vids} ? $d->{bridge_vids} : "2-4094";
 	    $raw .= "\tbridge-vids $vlans\n";
 	}
 	$done->{bridge_vlan_aware} = 1;
-- 
2.39.5





More information about the pve-devel mailing list