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