summaryrefslogtreecommitdiffstats
path: root/plugins/check_swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_swap.c')
-rw-r--r--plugins/check_swap.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index fe9254d2..8f5ebf8e 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -42,8 +42,8 @@ void print_help (void);
42 42
43int warn_percent = 0; 43int warn_percent = 0;
44int crit_percent = 0; 44int crit_percent = 0;
45float warn_size = 0; 45double warn_size = 0;
46float crit_size = 0; 46double crit_size = 0;
47int verbose; 47int verbose;
48int allswaps; 48int allswaps;
49 49
@@ -376,12 +376,13 @@ process_arguments (int argc, char **argv)
376 switch (c) { 376 switch (c) {
377 case 'w': /* warning size threshold */ 377 case 'w': /* warning size threshold */
378 if (is_intnonneg (optarg)) { 378 if (is_intnonneg (optarg)) {
379 warn_size = (float) atoi (optarg); 379 warn_size = (double) atoi (optarg);
380 break; 380 break;
381 } 381 }
382 else if (strstr (optarg, ",") && 382 else if (strstr (optarg, ",") &&
383 strstr (optarg, "%") && 383 strstr (optarg, "%") &&
384 sscanf (optarg, "%.0f,%d%%", &warn_size, &warn_percent) == 2) { 384 sscanf (optarg, "%g,%d%%", &warn_size, &warn_percent) == 2) {
385 warn_size = floor(warn_size);
385 break; 386 break;
386 } 387 }
387 else if (strstr (optarg, "%") && 388 else if (strstr (optarg, "%") &&
@@ -393,12 +394,13 @@ process_arguments (int argc, char **argv)
393 } 394 }
394 case 'c': /* critical size threshold */ 395 case 'c': /* critical size threshold */
395 if (is_intnonneg (optarg)) { 396 if (is_intnonneg (optarg)) {
396 crit_size = (float) atoi (optarg); 397 crit_size = (double) atoi (optarg);
397 break; 398 break;
398 } 399 }
399 else if (strstr (optarg, ",") && 400 else if (strstr (optarg, ",") &&
400 strstr (optarg, "%") && 401 strstr (optarg, "%") &&
401 sscanf (optarg, "%.0f,%d%%", &crit_size, &crit_percent) == 2) { 402 sscanf (optarg, "%g,%d%%", &crit_size, &crit_percent) == 2) {
403 crit_size = floor(crit_size);
402 break; 404 break;
403 } 405 }
404 else if (strstr (optarg, "%") && 406 else if (strstr (optarg, "%") &&
@@ -439,12 +441,12 @@ process_arguments (int argc, char **argv)
439 if (c == argc) 441 if (c == argc)
440 return validate_arguments (); 442 return validate_arguments ();
441 if (warn_size == 0 && is_intnonneg (argv[c])) 443 if (warn_size == 0 && is_intnonneg (argv[c]))
442 warn_size = (float) atoi (argv[c++]); 444 warn_size = (double) atoi (argv[c++]);
443 445
444 if (c == argc) 446 if (c == argc)
445 return validate_arguments (); 447 return validate_arguments ();
446 if (crit_size == 0 && is_intnonneg (argv[c])) 448 if (crit_size == 0 && is_intnonneg (argv[c]))
447 crit_size = atoi (argv[c++]); 449 crit_size = (double) atoi (argv[c++]);
448 450
449 return validate_arguments (); 451 return validate_arguments ();
450} 452}