]> git.ipfire.org Git - people/stevee/guardian.git/commitdiff
Adjust error messages in case of failure.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 25 Nov 2015 14:38:01 +0000 (15:38 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Wed, 25 Nov 2015 14:38:01 +0000 (15:38 +0100)
Remove the new line prefixes from various error messages.
The logger automatically will take care of this.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
guardian
modules/Base.pm
modules/Config.pm
modules/Socket.pm

index da9665cc8e8fb0d561655722707a66f72e3e510d..f480c11b9d7437e29e1f0864ebb806638a0dba1d 100644 (file)
--- a/guardian
+++ b/guardian
@@ -82,7 +82,7 @@ my %monitored_files :shared = ();
 
 # Create the main queue. It is used to store and process all events which are
 # reported and enqueued by the worker threads.
-my $queue :shared = new Thread::Queue or die "Could not create new, empty queue. $!\n";;
+my $queue :shared = new Thread::Queue or die "Could not create new, empty queue. $!";;
 
 # Array to store all currently running worker objects.
 # (Does not include the socket thread)
@@ -160,10 +160,10 @@ sub Worker ($) {
        $SIG{'KILL'} = sub { threads->exit(); };
 
        # Create inotify watcher.
-       my $watcher = new Linux::Inotify2 or die "Could not use inotify. $!\n";
+       my $watcher = new Linux::Inotify2 or die "Could not use inotify. $!";
 
        # Monitor the specified file.
-       $watcher->watch("$file", IN_MODIFY) or die "Could not monitor $file. $!\n";
+       $watcher->watch("$file", IN_MODIFY) or die "Could not monitor $file. $!";
 
        # Switch watcher into non-blocking mode.
        $watcher->blocking(0);
@@ -182,7 +182,7 @@ sub Worker ($) {
                        my $fileposition = $monitored_files{$file};
 
                        # Open the file.
-                       open (FILE, $file) or die "Could not open $file. $!\n";
+                       open (FILE, $file) or die "Could not open $file. $!";
 
                        # Seek to the last known position.
                        seek (FILE, $fileposition, 0);
index e4ff8a0abed48f12f3d47f04fded1b5cf330b556..0e43823628461cab951b66aba5accfd940aa3388 100644 (file)
@@ -20,7 +20,7 @@ sub InitFileposition ($) {
        my $file = $_[0];
 
        # Open the file.
-       open(FILE, $file) or die "Could not open $file. $!\n";
+       open(FILE, $file) or die "Could not open $file. $!";
 
        # Just seek to the end of the file (EOF).
        seek(FILE, 0, 2);
index 9f2fc55c89c2bbe6b769ac8976c40af36e562826..9a8e1fd582e6f7a7ee6fcb70e6f47c5ad383ac50 100644 (file)
@@ -56,7 +56,7 @@ sub UseConfig ($) {
 
        # If an error message is returned, exit and print the error message.
        } else {
-               die "Invalid configuration: $error\n";
+               die "Invalid configuration: $error";
        }
 }
 
@@ -74,11 +74,11 @@ sub ReadConfig ($) {
 
        # Check if the configfile exists and is read-able.
        unless (-r "$file") {
-                       die "The given configfile ($file) does not exist, or is not read-able: $!\n";
+                       die "The given configfile ($file) does not exist, or is not read-able: $!";
        }
 
        # Open the config file and read-in all configuration options and values.
-       open(CONF, "$file") or die "Could not open $file: $!\n";
+       open(CONF, "$file") or die "Could not open $file: $!";
 
        # Process line by line.
        while (my $line = <CONF>) {
index 5e5a9982e86cfff87603117591588713e7e12dd1..3b758dc4b780258965d261fb2a66786f84614d21 100644 (file)
@@ -33,13 +33,13 @@ sub Server () {
        # If the path for the socketfile does not exist, try to
        # create it.
        unless (-d "$socketpath") {
-               mkdir("$socketpath") or die "Could not create $socketpath: $!\n";
+               mkdir("$socketpath") or die "Could not create $socketpath: $!";
        }
 
        # Delete an existing socket file.
        if (-e "$socketfile") {
                unlink $socketfile
-               or die "Could not release existing socket file: $!\n";
+               or die "Could not release existing socket file: $!";
        }
 
        # Create a new UNIX socket.
@@ -47,7 +47,7 @@ sub Server () {
                Local => $socketfile,
                Listen => SOMAXCONN,
                Type => SOCK_STREAM,
-       ) or die "Could not create socket: $!\n";
+       ) or die "Could not create socket: $!";
 
        # Return the server object.
        return $server;