diff options
-rw-r--r-- | AUTHORS | 3 | ||||
-rw-r--r-- | plugins/check_swap.c | 9 |
2 files changed, 8 insertions, 4 deletions
@@ -101,4 +101,5 @@ Matt Pounsett | |||
101 | Shawn Wills | 101 | Shawn Wills |
102 | Ralph Rye | 102 | Ralph Rye |
103 | Jason Martin | 103 | Jason Martin |
104 | Jon Hallett \ No newline at end of file | 104 | Jon Hallett |
105 | Flo Gleixner | ||
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index fe792e8..1155ed0 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -73,8 +73,8 @@ main (int argc, char **argv) | |||
73 | bindtextdomain (PACKAGE, LOCALEDIR); | 73 | bindtextdomain (PACKAGE, LOCALEDIR); |
74 | textdomain (PACKAGE); | 74 | textdomain (PACKAGE); |
75 | 75 | ||
76 | status = strdup(""); | 76 | status = strdup (""); |
77 | perf = strdup(""); | 77 | perf = strdup (""); |
78 | 78 | ||
79 | if (process_arguments (argc, argv) != OK) | 79 | if (process_arguments (argc, argv) != OK) |
80 | usage (_("Invalid command arguments supplied\n")); | 80 | usage (_("Invalid command arguments supplied\n")); |
@@ -90,7 +90,10 @@ main (int argc, char **argv) | |||
90 | used_swap += dskused; | 90 | used_swap += dskused; |
91 | free_swap += dskfree; | 91 | free_swap += dskfree; |
92 | if (allswaps) { | 92 | if (allswaps) { |
93 | percent = 100 * (((double) dskused) / ((double) dsktotal)); | 93 | if (dsktotal == 0) |
94 | percent=100.0; | ||
95 | else | ||
96 | percent = 100 * (((double) dskused) / ((double) dsktotal)); | ||
94 | result = max_state (result, check_swap (percent, dskfree)); | 97 | result = max_state (result, check_swap (percent, dskfree)); |
95 | if (verbose) | 98 | if (verbose) |
96 | asprintf (&status, "%s [%llu (%d%%)]", status, dskfree, 100 - percent); | 99 | asprintf (&status, "%s [%llu (%d%%)]", status, dskfree, 100 - percent); |