diff options
| author | M. Sean Finney <seanius@users.sourceforge.net> | 2005-06-03 13:53:43 +0000 |
|---|---|---|
| committer | M. Sean Finney <seanius@users.sourceforge.net> | 2005-06-03 13:53:43 +0000 |
| commit | f61bb07f9526444a26e930538ad4dba6ddcd2087 (patch) | |
| tree | 76b2b4161a2562418ff84fb1fe5f0d5bd831698d /plugins | |
| parent | bba4957fb2a22445c398a462fa819eccec9e3fab (diff) | |
| download | monitoring-plugins-f61bb07f9526444a26e930538ad4dba6ddcd2087.tar.gz | |
gcc 2.x fixes from edward
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1188 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/check_procs.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 671190ca..dbd07aa4 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
| @@ -94,7 +94,7 @@ main (int argc, char **argv) | |||
| 94 | int procseconds = 0; | 94 | int procseconds = 0; |
| 95 | float procpcpu = 0; | 95 | float procpcpu = 0; |
| 96 | char procstat[8]; | 96 | char procstat[8]; |
| 97 | char procetime[MAX_INPUT_BUFFER]; | 97 | char procetime[MAX_INPUT_BUFFER] = { '\0' }; |
| 98 | char *procargs; | 98 | char *procargs; |
| 99 | char *temp_string; | 99 | char *temp_string; |
| 100 | 100 | ||
| @@ -108,12 +108,10 @@ main (int argc, char **argv) | |||
| 108 | int expected_cols = PS_COLS - 1; | 108 | int expected_cols = PS_COLS - 1; |
| 109 | int warn = 0; /* number of processes in warn state */ | 109 | int warn = 0; /* number of processes in warn state */ |
| 110 | int crit = 0; /* number of processes in crit state */ | 110 | int crit = 0; /* number of processes in crit state */ |
| 111 | procetime[0]='\0'; /* keep this clean because -vvv always prints it */ | ||
| 112 | int i = 0; | 111 | int i = 0; |
| 113 | |||
| 114 | int result = STATE_UNKNOWN; | 112 | int result = STATE_UNKNOWN; |
| 115 | 113 | ||
| 116 | //setlocale (LC_ALL, ""); | 114 | setlocale (LC_ALL, ""); |
| 117 | bindtextdomain (PACKAGE, LOCALEDIR); | 115 | bindtextdomain (PACKAGE, LOCALEDIR); |
| 118 | textdomain (PACKAGE); | 116 | textdomain (PACKAGE); |
| 119 | 117 | ||
| @@ -178,11 +176,10 @@ main (int argc, char **argv) | |||
| 178 | strip (procargs); | 176 | strip (procargs); |
| 179 | 177 | ||
| 180 | /* Some ps return full pathname for command. This removes path */ | 178 | /* Some ps return full pathname for command. This removes path */ |
| 181 | temp_string = strtok ((char *)procprog, "/"); | 179 | #ifdef HAVE_BASENAME |
| 182 | while (temp_string) { | 180 | temp_string = strdup(procprog); |
| 183 | strcpy(procprog, temp_string); | 181 | procprog = basename(temp_string); |
| 184 | temp_string = strtok (NULL, "/"); | 182 | #endif /* HAVE_BASENAME */ |
| 185 | } | ||
| 186 | 183 | ||
| 187 | /* we need to convert the elapsed time to seconds */ | 184 | /* we need to convert the elapsed time to seconds */ |
| 188 | procseconds = convert_to_seconds(procetime); | 185 | procseconds = convert_to_seconds(procetime); |
| @@ -643,6 +640,9 @@ convert_to_seconds(char *etime) { | |||
| 643 | (minutes * 60) + | 640 | (minutes * 60) + |
| 644 | seconds; | 641 | seconds; |
| 645 | 642 | ||
| 643 | if (verbose >= 3 && metric == METRIC_ELAPSED) { | ||
| 644 | printf("seconds: %d\n", total); | ||
| 645 | } | ||
| 646 | return total; | 646 | return total; |
| 647 | } | 647 | } |
| 648 | 648 | ||
