]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
ids-functions.pl: Remove temporary files if the downloader aborts.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 17 Apr 2022 14:38:21 +0000 (16:38 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 17 Apr 2022 14:38:21 +0000 (16:38 +0200)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/ids-functions.pl

index c916926de7f41bbecb75c487abd848d343b96239..41a07897b2354d99a9058553a9a16591bd05f15e 100644 (file)
@@ -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";
                }