diff options
author | Sebastian Schmidt <sschmidt@interhyp.de> | 2013-08-18 10:44:48 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-18 10:59:57 (GMT) |
commit | 0efedfb77c9130899c47a3ac80fc0c2226472c31 (patch) | |
tree | cbf4b0e3ddf416598b57f031b8f3cc479c04a631 /plugins | |
parent | 0f686d436e5e18d6f40fecc01128d3f383439b35 (diff) | |
download | monitoring-plugins-0efedfb77c9130899c47a3ac80fc0c2226472c31.tar.gz |
check_procs: Assume we have stat()
stat() is in gnulib anyway, so we can safely depend on it.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_procs.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 3b4c822..873d929 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -46,10 +46,6 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
46 | 46 | ||
47 | #ifdef HAVE_SYS_STAT_H | 47 | #ifdef HAVE_SYS_STAT_H |
48 | #include <sys/stat.h> | 48 | #include <sys/stat.h> |
49 | typedef struct stat struct_stat_t; | ||
50 | #else | ||
51 | /* won't be used anyway */ | ||
52 | typedef struct { dev_t st_dev; ino_t st_ino; } struct_stat_t; | ||
53 | #endif | 49 | #endif |
54 | 50 | ||
55 | int process_arguments (int, char **); | 51 | int process_arguments (int, char **); |
@@ -109,17 +105,13 @@ int usepid = 0; /* whether to test for pid or /proc/pid/exe */ | |||
109 | FILE *ps_input = NULL; | 105 | FILE *ps_input = NULL; |
110 | 106 | ||
111 | static int | 107 | static int |
112 | stat_exe (const pid_t pid, struct_stat_t *buf) { | 108 | stat_exe (const pid_t pid, struct stat *buf) { |
113 | #ifdef HAVE_SYS_STAT_H | ||
114 | char *path; | 109 | char *path; |
115 | int ret; | 110 | int ret; |
116 | xasprintf(&path, "/proc/%d/exe", pid); | 111 | xasprintf(&path, "/proc/%d/exe", pid); |
117 | ret = stat(path, buf); | 112 | ret = stat(path, buf); |
118 | free(path); | 113 | free(path); |
119 | return ret; | 114 | return ret; |
120 | #else | ||
121 | return -1; | ||
122 | #endif | ||
123 | } | 115 | } |
124 | 116 | ||
125 | 117 | ||
@@ -131,7 +123,7 @@ main (int argc, char **argv) | |||
131 | char *procprog; | 123 | char *procprog; |
132 | 124 | ||
133 | pid_t mypid = 0; | 125 | pid_t mypid = 0; |
134 | struct_stat_t statbuf; | 126 | struct stat statbuf; |
135 | dev_t mydev = 0; | 127 | dev_t mydev = 0; |
136 | ino_t myino = 0; | 128 | ino_t myino = 0; |
137 | int procuid = 0; | 129 | int procuid = 0; |