all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH guest-common] tunnel: improve version error handling
Date: Fri, 18 Apr 2025 10:36:58 +0200	[thread overview]
Message-ID: <20250418083658.137741-1-f.gruenbichler@proxmox.com> (raw)

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

             reply	other threads:[~2025-04-18  8:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-18  8:36 Fabian Grünbichler [this message]
2025-05-27  9:50 ` [pve-devel] applied: " Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250418083658.137741-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal