5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2024-12-22 13:34:16 +03:00

base plugin: do not decode the empty string

If the json was empty, for example if the qemu-img command times out, a
message

    warn "could not parse qemu-img info command output for '$filename' - $err\n";

would have been printed.

This message could lead one to think the issue lies in the contents of
the json, even if the previous warning said that there was a timeout.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
Maximiliano Sandoval 2024-09-02 14:47:45 +02:00 committed by Thomas Lamprecht
parent fe854c9658
commit 851cc07a2a

View File

@ -974,6 +974,10 @@ sub file_size_info {
# otherwise we warn about it and try to parse the json
warn $err_output;
}
if (!$json) {
# skip decoding if there was no output, e.g. if there was a timeout.
return wantarray ? (undef, undef, undef, undef, $st->ctime) : undef;
}
my $info = eval { decode_json($json) };
if (my $err = $@) {