summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_procs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index 6a30ce00..d6441f0a 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -42,6 +42,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
42#include "regex.h" 42#include "regex.h"
43 43
44#include <pwd.h> 44#include <pwd.h>
45#include <errno.h>
45 46
46#ifdef HAVE_SYS_STAT_H 47#ifdef HAVE_SYS_STAT_H
47#include <sys/stat.h> 48#include <sys/stat.h>
@@ -157,6 +158,7 @@ main (int argc, char **argv)
157 int crit = 0; /* number of processes in crit state */ 158 int crit = 0; /* number of processes in crit state */
158 int i = 0, j = 0; 159 int i = 0, j = 0;
159 int result = STATE_UNKNOWN; 160 int result = STATE_UNKNOWN;
161 int ret;
160 output chld_out, chld_err; 162 output chld_out, chld_err;
161 163
162 setlocale (LC_ALL, ""); 164 setlocale (LC_ALL, "");
@@ -241,7 +243,8 @@ main (int argc, char **argv)
241 243
242 /* Ignore self */ 244 /* Ignore self */
243 if ((usepid && mypid == procpid) || 245 if ((usepid && mypid == procpid) ||
244 (!usepid && stat_exe(procpid, &statbuf) != -1 && statbuf.st_dev == mydev && statbuf.st_ino == myino)) { 246 (!usepid && ((ret = stat_exe(procpid, &statbuf) != -1) && statbuf.st_dev == mydev && statbuf.st_ino == myino) ||
247 (ret == -1 && errno == ENOENT))) {
245 if (verbose >= 3) 248 if (verbose >= 3)
246 printf("not considering - is myself\n"); 249 printf("not considering - is myself\n");
247 continue; 250 continue;