diff options
Diffstat (limited to 'plugins/check_smtp.c')
-rw-r--r-- | plugins/check_smtp.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 79fa482..d477a51 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
@@ -99,9 +99,9 @@ char **responses = NULL; | |||
99 | char *authtype = NULL; | 99 | char *authtype = NULL; |
100 | char *authuser = NULL; | 100 | char *authuser = NULL; |
101 | char *authpass = NULL; | 101 | char *authpass = NULL; |
102 | int warning_time = 0; | 102 | double warning_time = 0; |
103 | int check_warning_time = FALSE; | 103 | int check_warning_time = FALSE; |
104 | int critical_time = 0; | 104 | double critical_time = 0; |
105 | int check_critical_time = FALSE; | 105 | int check_critical_time = FALSE; |
106 | int verbose = 0; | 106 | int verbose = 0; |
107 | int use_ssl = FALSE; | 107 | int use_ssl = FALSE; |
@@ -417,9 +417,9 @@ main (int argc, char **argv) | |||
417 | elapsed_time = (double)microsec / 1.0e6; | 417 | elapsed_time = (double)microsec / 1.0e6; |
418 | 418 | ||
419 | if (result == STATE_OK) { | 419 | if (result == STATE_OK) { |
420 | if (check_critical_time && elapsed_time > (double) critical_time) | 420 | if (check_critical_time && elapsed_time > critical_time) |
421 | result = STATE_CRITICAL; | 421 | result = STATE_CRITICAL; |
422 | else if (check_warning_time && elapsed_time > (double) warning_time) | 422 | else if (check_warning_time && elapsed_time > warning_time) |
423 | result = STATE_WARNING; | 423 | result = STATE_WARNING; |
424 | } | 424 | } |
425 | 425 | ||
@@ -552,21 +552,19 @@ process_arguments (int argc, char **argv) | |||
552 | nresponses++; | 552 | nresponses++; |
553 | break; | 553 | break; |
554 | case 'c': /* critical time threshold */ | 554 | case 'c': /* critical time threshold */ |
555 | if (is_intnonneg (optarg)) { | 555 | if (!is_nonnegative (optarg)) |
556 | critical_time = atoi (optarg); | 556 | usage4 (_("Critical time must be a positive")); |
557 | check_critical_time = TRUE; | ||
558 | } | ||
559 | else { | 557 | else { |
560 | usage4 (_("Critical time must be a positive integer")); | 558 | critical_time = strtod (optarg, NULL); |
559 | check_critical_time = TRUE; | ||
561 | } | 560 | } |
562 | break; | 561 | break; |
563 | case 'w': /* warning time threshold */ | 562 | case 'w': /* warning time threshold */ |
564 | if (is_intnonneg (optarg)) { | 563 | if (!is_nonnegative (optarg)) |
565 | warning_time = atoi (optarg); | 564 | usage4 (_("Warning time must be a positive")); |
566 | check_warning_time = TRUE; | ||
567 | } | ||
568 | else { | 565 | else { |
569 | usage4 (_("Warning time must be a positive integer")); | 566 | warning_time = strtod (optarg, NULL); |
567 | check_warning_time = TRUE; | ||
570 | } | 568 | } |
571 | break; | 569 | break; |
572 | case 'v': /* verbose */ | 570 | case 'v': /* verbose */ |