public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH guest-common] tunnel: improve version error handling
@ 2025-04-18  8:36 Fabian Grünbichler
  0 siblings, 0 replies; only message in thread
From: Fabian Grünbichler @ 2025-04-18  8:36 UTC (permalink / raw)
  To: pve-devel

prevent a warning about $ver being an uninitialized value in case the tunnel
didn't provide a version string at all, for example because it already closed
cause of a prior error.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
prompted by https://bugzilla.proxmox.com/show_bug.cgi?id=6340

 src/PVE/Tunnel.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Tunnel.pm b/src/PVE/Tunnel.pm
index 4f8df8e..30cebfc 100644
--- a/src/PVE/Tunnel.pm
+++ b/src/PVE/Tunnel.pm
@@ -179,7 +179,9 @@ sub fork_ssh_tunnel {
 
     eval {
 	my $ver = read_tunnel($tunnel, 10);
-	if ($ver =~ /^ver (\d+)$/) {
+	if (!defined($ver)) {
+	    $err = "failed to receive tunnel version string\n" if !$err;
+	} elsif ($ver =~ /^ver (\d+)$/) {
 	    $tunnel->{version} = $1;
 	    $log->('info', "ssh tunnel $ver\n");
 	} else {
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-04-18  8:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-18  8:36 [pve-devel] [PATCH guest-common] tunnel: improve version error handling Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal