]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/cfgroot/ids-functions.pl
ids-functions.pl: Add function to create empty files
[ipfire-2.x.git] / config / cfgroot / ids-functions.pl
index cb16e1b49309030e7ef3238f8a1ff2e0c7f5e819..6f7f3ee7ef7eb07857a5982607c13fdf734a70b6 100644 (file)
@@ -355,4 +355,26 @@ sub call_suricatactrl ($) {
        return;
 }
 
+#
+## Function to create a new empty file.
+#
+sub create_empty_file($) {
+       my ($file) = @_;
+
+       # Check if the given file exists.
+       if(-e $file) {
+               # Do nothing to prevent from overwriting existing files.
+               return;
+       }
+
+       # Open the file for writing.
+       open(FILE, ">$file") or die "Could not write to $file. $!\n";
+
+       # Close file handle.
+       close(FILE);
+
+       # Return true.
+       return 1;
+}
+
 1;