From e573445e938ad384375264b62572b239dbbf12ea Mon Sep 17 00:00:00 2001 From: Daniel Tschlatscher Date: Tue, 14 Jun 2022 11:00:11 +0200 Subject: [PATCH] Adapted unlink calls for archive files in case of ENOENT This improves handling when two archive remove calls are creating a race condition where one would formerly encounter an error. Now both finish successfully. Signed-off-by: Daniel Tschlatscher Reviewed-by: Fabian Ebner Signed-off-by: Wolfgang Bumiller --- PVE/Storage.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 70dd663..97ea64e 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -1586,7 +1586,7 @@ sub archive_remove { die "cannot remove protected archive '$archive_path'\n" if -e protection_file_path($archive_path); - unlink $archive_path or die "removing archive $archive_path failed: $!\n"; + unlink $archive_path or $! == ENOENT or die "removing archive $archive_path failed: $!\n"; archive_auxiliaries_remove($archive_path); } @@ -1602,7 +1602,7 @@ sub archive_auxiliaries_remove { my $path = "$dirname/$filename"; if (-e $path) { - unlink $path or warn "Removing $type file failed: $!\n"; + unlink $path or $! == ENOENT or warn "Removing $type file failed: $!\n"; } } }