From f6aeefff548a924d092b31cf15f41ad36dc52fe4 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Tue, 31 Aug 2021 12:16:29 +0200 Subject: [PATCH] status: move unlink from http-server to enpoint this is the first step in which not the http server removes the temporary file, but the worker itself. Signed-off-by: Lorenz Stechauner --- PVE/API2/Storage/Status.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PVE/API2/Storage/Status.pm b/PVE/API2/Storage/Status.pm index b838461..cc8ed5a 100644 --- a/PVE/API2/Storage/Status.pm +++ b/PVE/API2/Storage/Status.pm @@ -486,6 +486,12 @@ __PACKAGE__->register_method ({ print "command: " . join(' ', @$cmd) . "\n"; eval { run_command($cmd, errmsg => 'import failed'); }; + + # unlinks only the temporary file from the http server + unlink $tmpfilename; + warn "unable to clean up temporary file '$tmpfilename' - $!\n" + if $! && $! != ENOENT; + if (my $err = $@) { eval { $err_cleanup->() }; warn "$@" if $@;