5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-02-03 13:47:16 +03:00

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 <d.tschlatscher@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Daniel Tschlatscher 2022-06-14 11:00:11 +02:00 committed by Wolfgang Bumiller
parent c3e2ff806f
commit e573445e93

View File

@ -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";
}
}
}