api: oci image pull: unconditionally unlink temporary file on interrupt
It's more robust and cheaper to just always unlink (always one syscall) and ignore ENOENT compared to stat and optional unlink (two syscalls worst case). Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
@ -977,8 +977,8 @@ __PACKAGE__->register_method({
|
||||
|
||||
local $SIG{INT} = sub {
|
||||
unlink "$path/$tmp_filename"
|
||||
or warn "could not cleanup temporary file: $!"
|
||||
if -e "$path/$tmp_filename";
|
||||
or $!{ENOENT}
|
||||
or warn "could not cleanup temporary file: $!";
|
||||
die "got interrupted by signal\n";
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user