]> git.ipfire.org Git - people/stevee/guardian.git/blobdiff - modules/Socket.pm
Socket.pm: Add tiny subroutine to drop an existing socket file.
[people/stevee/guardian.git] / modules / Socket.pm
index cdcca0016d35fbb14c6c222cb08f43af32543e48..5e5a9982e86cfff87603117591588713e7e12dd1 100644 (file)
@@ -4,7 +4,7 @@ use warnings;
 
 use Exporter qw(import);
 
-our @EXPORT_OK = qw(Server Client Message_Parser);
+our @EXPORT_OK = qw(Server Client Message_Parser RemoveSocketFile);
 
 use IO::Socket::UNIX qw( SOCK_STREAM SOMAXCONN );
 
@@ -114,4 +114,17 @@ sub Message_Parser ($) {
        return undef;
 }
 
+#
+## RemoveSocketFile function.
+#
+## A tiny function which just removes an existing Socket file.
+#
+sub RemoveSocketFile () {
+       # Check if a socketfile exists.
+       if (-e $socketfile) {
+               # Delete the socket file.
+               unlink($socketfile);
+       }
+}
+
 1;