[nagiosplug] check_procs: Assume we have stat()

Nagios Plugin Development nagios-plugins at users.sourceforge.net
Sun Aug 18 13:10:22 CEST 2013


    Module: nagiosplug
    Branch: master
    Commit: 0efedfb77c9130899c47a3ac80fc0c2226472c31
    Author: Sebastian Schmidt <sschmidt at interhyp.de>
 Committer: Holger Weiss <holger at zedat.fu-berlin.de>
      Date: Sun Aug 18 12:44:48 2013 +0200
       URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=0efedfb

check_procs: Assume we have stat()

stat() is in gnulib anyway, so we can safely depend on it.

---

 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 at lists.sourceforge.net";
 
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
-typedef struct stat struct_stat_t;
-#else
-/* won't be used anyway */
-typedef struct { dev_t st_dev; ino_t st_ino; } struct_stat_t;
 #endif
 
 int process_arguments (int, char **);
@@ -109,17 +105,13 @@ int usepid = 0; /* whether to test for pid or /proc/pid/exe */
 FILE *ps_input = NULL;
 
 static int
-stat_exe (const pid_t pid, struct_stat_t *buf) {
-#ifdef HAVE_SYS_STAT_H
+stat_exe (const pid_t pid, struct stat *buf) {
 	char *path;
 	int ret;
 	xasprintf(&path, "/proc/%d/exe", pid);
 	ret = stat(path, buf);
 	free(path);
 	return ret;
-#else
-	return -1;
-#endif
 }
 
 
@@ -131,7 +123,7 @@ main (int argc, char **argv)
 	char *procprog;
 
 	pid_t mypid = 0;
-	struct_stat_t statbuf;
+	struct stat statbuf;
 	dev_t mydev = 0;
 	ino_t myino = 0;
 	int procuid = 0;





More information about the Commits mailing list