]> git.michaelhowe.org Git - packages/a/afs-monitor.git/commitdiff
Handle unlimited quota volumes in check_afs_quotas
authorErik Dalén <erik.dalen@mensa.se>
Sun, 12 Dec 2010 20:04:51 +0000 (12:04 -0800)
committerRuss Allbery <rra@stanford.edu>
Sun, 12 Dec 2010 20:04:51 +0000 (12:04 -0800)
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

index 4c9d6309fe85633dcafb65b6872bbc8335e9c250..4dd02f39bc9a04770b82c64f858381e2e04ab71d 100755 (executable)
@@ -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');