mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-03-24 03:13:05 -04:00
fix div by zero error when swaptotal is zero (Flo Gleixner)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@834 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
parent
3c81964713
commit
c06a468094
2 changed files with 8 additions and 4 deletions
3
AUTHORS
3
AUTHORS
|
|
@ -101,4 +101,5 @@ Matt Pounsett
|
|||
Shawn Wills
|
||||
Ralph Rye
|
||||
Jason Martin
|
||||
Jon Hallett
|
||||
Jon Hallett
|
||||
Flo Gleixner
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ main (int argc, char **argv)
|
|||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
status = strdup("");
|
||||
perf = strdup("");
|
||||
status = strdup ("");
|
||||
perf = strdup ("");
|
||||
|
||||
if (process_arguments (argc, argv) != OK)
|
||||
usage (_("Invalid command arguments supplied\n"));
|
||||
|
|
@ -90,7 +90,10 @@ main (int argc, char **argv)
|
|||
used_swap += dskused;
|
||||
free_swap += dskfree;
|
||||
if (allswaps) {
|
||||
percent = 100 * (((double) dskused) / ((double) dsktotal));
|
||||
if (dsktotal == 0)
|
||||
percent=100.0;
|
||||
else
|
||||
percent = 100 * (((double) dskused) / ((double) dsktotal));
|
||||
result = max_state (result, check_swap (percent, dskfree));
|
||||
if (verbose)
|
||||
asprintf (&status, "%s [%llu (%d%%)]", status, dskfree, 100 - percent);
|
||||
|
|
|
|||
Loading…
Reference in a new issue