pvesm import: improve handling of interrupted export

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>
This commit is contained in:
Fabian Grünbichler
2019-11-27 13:48:58 +01:00
committed by Thomas Lamprecht
parent 97cf933fe5
commit f105c1766e

View 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;