From c45b9b430a6ec1ff8f56f5a31c3a23df93bf5f6e Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 17 Nov 2025 21:45:24 +0100 Subject: [PATCH] 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 --- src/PVE/API2/Storage/Status.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/API2/Storage/Status.pm b/src/PVE/API2/Storage/Status.pm index 8e17156..31bcc6d 100644 --- a/src/PVE/API2/Storage/Status.pm +++ b/src/PVE/API2/Storage/Status.pm @@ -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"; };