[pve-devel] [PATCH qemu-server 1/4] usb: fix undef error on string match

Dominik Csapak d.csapak at proxmox.com
Mon Mar 18 12:18:30 CET 2024


'$entry->{host}' can be empty, so we have to check for that before
doing a regex check, otherwise we get ugly errors in the log

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/QemuServer.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 8d0ed22c..6e2c8052 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2597,7 +2597,7 @@ sub check_local_resources {
     foreach my $k (keys %$conf) {
 	if ($k =~ m/^usb/) {
 	    my $entry = parse_property_string('pve-qm-usb', $conf->{$k});
-	    next if $entry->{host} =~ m/^spice$/i;
+	    next if $entry->{host} && $entry->{host} =~ m/^spice$/i;
 	    if ($entry->{mapping}) {
 		$add_missing_mapping->('usb', $k, $entry->{mapping});
 		push @$mapped_res, $k;
-- 
2.39.2





More information about the pve-devel mailing list