]> git.proxmox.com Git - pve-storage.git/commitdiff
pvesm import: improve handling of interrupted export
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 27 Nov 2019 12:48:58 +0000 (13:48 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 27 Nov 2019 13:36:19 +0000 (14:36 +0100)
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 <f.gruenbichler@proxmox.com>
PVE/Storage/Plugin.pm

index 283eafccb2b57ab3e55ed981e653b96a1832d6e5..963c391b29803831f7e66988b90cdca4fa44fdef 100644 (file)
@@ -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;