From 482fe8e9a76880a7ed14af2f66fd08a801bead90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Erik=20Dal=C3=A9n?= Date: Sun, 12 Dec 2010 12:04:51 -0800 Subject: [PATCH] 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. --- check_afs_quotas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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'); -- 2.39.5