From: Erik Dalén Date: Sun, 12 Dec 2010 20:04:51 +0000 (-0800) Subject: Handle unlimited quota volumes in check_afs_quotas X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=482fe8e9a76880a7ed14af2f66fd08a801bead90;p=packages%2Fa%2Fafs-monitor.git Handle unlimited quota volumes in check_afs_quotas Volumes with unlimited quota previously caused a division by zero error in check_afs_quotas. Special-case the quota value of 0. --- diff --git a/check_afs_quotas b/check_afs_quotas index 4c9d630..4dd02f3 100755 --- a/check_afs_quotas +++ b/check_afs_quotas @@ -125,7 +125,10 @@ sub summarize_volume { my $used = $$results{size}; my $free = $total - $used; $free = 0 if ($free < 0); - my $percent = int ((($total - $free) / $total) * 100); + my $percent = 0; + if ($total > 0) { + $percent = int ((($total - $free) / $total) * 100); + } if ($FORMAT) { $total = format_bytes ($total, mode => 'iec'); $free = format_bytes ($free, mode => 'iec');