]> arthur.barton.de Git - netatalk.git/commitdiff
When the user's disk usage exceeds quota hard limit, report bytes free as 0,
authorjmarcus <jmarcus>
Sat, 19 Jan 2002 17:27:20 +0000 (17:27 +0000)
committerjmarcus <jmarcus>
Sat, 19 Jan 2002 17:27:20 +0000 (17:27 +0000)
and bytes total as the number of types the user is currently using.

etc/afpd/quota.c

index 9eaf63eaba124d40ac51064668ccf07421f7b5c9..35d33e19543486b6dd10e9de315515342606e5ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: quota.c,v 1.17 2002-01-19 00:22:23 jmarcus Exp $
+ * $Id: quota.c,v 1.18 2002-01-19 17:27:20 jmarcus Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -413,10 +413,15 @@ const u_int32_t bsize;
     if (dqblk.dqb_bsoftlimit == 0 && dqblk.dqb_bhardlimit == 0) {
         *btotal = *bfree = ~((VolSpace) 0);
     } else if ( overquota( &dqblk )) {
-        *btotal = tobytes( dqblk.dqb_bhardlimit, bsize );
-               *bfree = tobytes( dqblk.dqb_bhardlimit, bsize ) -
-                        tobytes( dqblk.dqb_curblocks, bsize );
-
+        if ( tobytes( dqblk.dqb_curblocks, bsize ) > tobytes( dqblk.dqb_bhardlimit, bsize ) ) {
+            *btotal = tobytes( dqblk.dqb_curblocks, bsize );
+            *bfree = 0;
+        }
+        else {
+            *btotal = tobytes( dqblk.dqb_bhardlimit, bsize );
+            *bfree = tobytes( dqblk.dqb_bhardlimit, bsize ) -
+                     tobytes( dqblk.dqb_curblocks, bsize );
+        }
     } else {
         *btotal = tobytes( dqblk.dqb_bsoftlimit, bsize );
         *bfree = tobytes( dqblk.dqb_bsoftlimit, bsize  ) -