On 03/08/2021 14:16, Lorenz Stechauner wrote:
> this is the first step in which not the http server removes the
> temporary file, but the worker itself.
> 
> Signed-off-by: Lorenz Stechauner <l.stechau...@proxmox.com>
> ---
>  PVE/API2/Storage/Status.pm | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/PVE/API2/Storage/Status.pm b/PVE/API2/Storage/Status.pm
> index b838461..a5ac372 100644
> --- a/PVE/API2/Storage/Status.pm
> +++ b/PVE/API2/Storage/Status.pm
> @@ -486,6 +486,7 @@ __PACKAGE__->register_method ({
>           print "command: " . join(' ', @$cmd) . "\n";
>  
>           eval { run_command($cmd, errmsg => 'import failed'); };
> +         unlink $tmpfilename or warn "unable to clean up temporary file 
> '$tmpfilename' - $!";

nit as it may not happen often in practice but it could be good to check if 
unlink
only failed because it is already gone (or was never produced):

unlink $tmpfilename;
warn "unable to clean up temporary file '$tmpfilename' - $!" if $! && $! != 
ENOENT;

(just wrote that from top of my mind, so not tested, you may need to add a
`use POSIX qw(ENOENT)` stanza in the module.)

>           if (my $err = $@) {
>               eval { $err_cleanup->() };
>               warn "$@" if $@;
> 



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to