- *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 );
+ }