diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 6279e048..48df3543 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -4750,11 +4750,11 @@ sub tar_archive_read_firstfile { die "ERROR: file '$archive' does not exist\n" if ! -f $archive; # try to detect archive type first - my $pid = open (TMP, "tar tf '$archive'|") || + my $pid = open (my $fh, '-|', 'tar', 'tf', $archive) || die "unable to open file '$archive'\n"; - my $firstfile = ; + my $firstfile = <$fh>; kill 15, $pid; - close TMP; + close $fh; die "ERROR: archive contaions no data\n" if !$firstfile; chomp $firstfile;