From f105c1766e06d5aed120c293496e4e861f7bb7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 27 Nov 2019 13:48:58 +0100 Subject: [PATCH] pvesm import: improve handling of interrupted export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit since 'pvesm export' and 'pvesm import' are connected via a pipe and SSH, a fatal error in the former can lead to no valid header being written to the pipe. handle this more gracefully by printing an easier to understand error message, instead of uninitialized warnings with no context. Signed-off-by: Fabian Grünbichler --- PVE/Storage/Plugin.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm index 283eafc..963c391 100644 --- a/PVE/Storage/Plugin.pm +++ b/PVE/Storage/Plugin.pm @@ -1115,6 +1115,7 @@ sub read_common_header($) { my ($fh) = @_; sysread($fh, my $size, 8); $size = unpack('Q<', $size); + die "import: no size found in export header, aborting.\n" if !defined($size); die "got a bad size (not a multiple of 1K)\n" if ($size&1023); # Size is in bytes! return $size;