From: Stefan Schantl Date: Sun, 17 Apr 2022 14:38:21 +0000 (+0200) Subject: ids-functions.pl: Remove temporary files if the downloader aborts. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38cf581405290ac9781793e8785cbdf0e210dced;p=people%2Fstevee%2Fipfire-2.x.git ids-functions.pl: Remove temporary files if the downloader aborts. Signed-off-by: Stefan Schantl --- diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index c916926de7..41a07897b2 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -427,6 +427,9 @@ sub downloadruleset ($) { # Check if the server responds with 304 (Not Modified). } elsif ($response->code == 304) { + # Remove temporary file, if one exists. + unlink("$tmpfile") if (-e "$tmpfile"); + # Return "not modified". return "not modified"; @@ -435,6 +438,9 @@ sub downloadruleset ($) { # Obtain error. my $error = $response->content; + # Remove temporary file, if one exists. + unlink("$tmpfile") if (-e "$tmpfile"); + # Return the error message from response.. return "$error"; }