[Nagiosplug-checkins] nagiosplug/plugins check_procs.c,1.44,1.45
M. Sean Finney
seanius at users.sourceforge.net
Fri Jun 3 06:55:35 CEST 2005
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23841
Modified Files:
check_procs.c
Log Message:
gcc 2.x fixes from edward
Index: check_procs.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_procs.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- check_procs.c 25 May 2005 00:43:20 -0000 1.44
+++ check_procs.c 3 Jun 2005 13:53:43 -0000 1.45
@@ -94,7 +94,7 @@
int procseconds = 0;
float procpcpu = 0;
char procstat[8];
- char procetime[MAX_INPUT_BUFFER];
+ char procetime[MAX_INPUT_BUFFER] = { '\0' };
char *procargs;
char *temp_string;
@@ -108,12 +108,10 @@
int expected_cols = PS_COLS - 1;
int warn = 0; /* number of processes in warn state */
int crit = 0; /* number of processes in crit state */
- procetime[0]='\0'; /* keep this clean because -vvv always prints it */
int i = 0;
-
int result = STATE_UNKNOWN;
- //setlocale (LC_ALL, "");
+ setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -178,11 +176,10 @@
strip (procargs);
/* Some ps return full pathname for command. This removes path */
- temp_string = strtok ((char *)procprog, "/");
- while (temp_string) {
- strcpy(procprog, temp_string);
- temp_string = strtok (NULL, "/");
- }
+#ifdef HAVE_BASENAME
+ temp_string = strdup(procprog);
+ procprog = basename(temp_string);
+#endif /* HAVE_BASENAME */
/* we need to convert the elapsed time to seconds */
procseconds = convert_to_seconds(procetime);
@@ -643,6 +640,9 @@
(minutes * 60) +
seconds;
+ if (verbose >= 3 && metric == METRIC_ELAPSED) {
+ printf("seconds: %d\n", total);
+ }
return total;
}
More information about the Commits
mailing list