better pid file error reporting under syslog for psadwatchd
authorMichael Rash <mbr@cipherdyne.org>
Sat, 8 Feb 2014 16:47:44 +0000 (11:47 -0500)
committerMichael Rash <mbr@cipherdyne.org>
Sat, 8 Feb 2014 16:47:44 +0000 (11:47 -0500)
psadwatchd.c

index ecb399e..50de597 100644 (file)
@@ -216,6 +216,9 @@ static void check_process(
 #ifdef DEBUG
     fprintf(stderr, "[-] Could not open pid file: %s\n", pid_file);
 #endif
+        snprintf(syslog_str, MAX_MSG_LEN,
+                "could not open pid file: %s on %s", pid_file, hostname);
+        slogr("psad(psadwatchd)", syslog_str);
         /* the pid file must not exist (or we can't read it), so
          * setup to start the appropriate process */
         restart = 1;
@@ -231,8 +234,13 @@ static void check_process(
 #endif
             fclose(pidfile_ptr);
 
+            snprintf(syslog_str, MAX_MSG_LEN,
+                "could not read pid file: %s on %s", pid_file, hostname);
+            slogr("psad(psadwatchd)", syslog_str);
+
             /* see if we need to give up */
             incr_syscall_ctr(pid_name, max_retries);
+
             return;
         }