summaryrefslogtreecommitdiffstats
path: root/plugins/negate.c
diff options
context:
space:
mode:
authorSven Nierlein <sven@nierlein.org>2014-06-28 20:14:02 (GMT)
committerSven Nierlein <sven@nierlein.org>2014-06-28 20:14:02 (GMT)
commitea8ab2002cd72f657582f4dd0a0580bd10131401 (patch)
tree43245ea6bf7f3e7cd0e6ca344dfc94c68189cca2 /plugins/negate.c
parente566021a54c500aa2ee0f17bfe4f95d1fd1be243 (diff)
parent9123f6146c5dd3285d8fb78cf3a8cd52bad17ec1 (diff)
downloadmonitoring-plugins-ea8ab2002cd72f657582f4dd0a0580bd10131401.tar.gz
Merge pull request #1263 from waja/coverity_fixes
Serveral coverity fixes from nagios-plugins
Diffstat (limited to 'plugins/negate.c')
-rw-r--r--plugins/negate.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/plugins/negate.c b/plugins/negate.c
index 4bd09de..d512e34 100644
--- a/plugins/negate.c
+++ b/plugins/negate.c
@@ -44,7 +44,7 @@ const char *email = "devel@monitoring-plugins.org";
44/* char *command_line; */ 44/* char *command_line; */
45 45
46static const char **process_arguments (int, char **); 46static const char **process_arguments (int, char **);
47int validate_arguments (char **); 47void validate_arguments (char **);
48void print_help (void); 48void print_help (void);
49void print_usage (void); 49void print_usage (void);
50int subst_text = FALSE; 50int subst_text = FALSE;
@@ -98,8 +98,7 @@ main (int argc, char **argv)
98 die (max_state_alt (result, STATE_UNKNOWN), _("No data returned from command\n")); 98 die (max_state_alt (result, STATE_UNKNOWN), _("No data returned from command\n"));
99 99
100 for (i = 0; i < chld_out.lines; i++) { 100 for (i = 0; i < chld_out.lines; i++) {
101 if (subst_text && result != state[result] && 101 if (subst_text && result >= 0 && result <= 4 && result != state[result]) {
102 result >= 0 && result <= 4) {
103 /* Loop over each match found */ 102 /* Loop over each match found */
104 while ((sub = strstr (chld_out.line[i], state_text (result)))) { 103 while ((sub = strstr (chld_out.line[i], state_text (result)))) {
105 /* Terminate the first part and skip over the string we'll substitute */ 104 /* Terminate the first part and skip over the string we'll substitute */
@@ -206,7 +205,7 @@ process_arguments (int argc, char **argv)
206} 205}
207 206
208 207
209int 208void
210validate_arguments (char **command_line) 209validate_arguments (char **command_line)
211{ 210{
212 if (command_line[0] == NULL) 211 if (command_line[0] == NULL)