Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/usr.bin/quota Pull up revision 1.22 (requested by bouyer):



details:   https://anonhg.NetBSD.org/src/rev/1f50a963a24d
branches:  netbsd-1-4
changeset: 469875:1f50a963a24d
user:      he <he%NetBSD.org@localhost>
date:      Thu Dec 16 23:54:46 1999 +0000

description:
Pull up revision 1.22 (requested by bouyer):
  Allow use of quotas bigger than 4GB by avoiding integer overflow.

diffstat:

 usr.bin/quota/quota.c |  64 +++++++++++++++++++++++++++-----------------------
 1 files changed, 34 insertions(+), 30 deletions(-)

diffs (107 lines):

diff -r 260411b28248 -r 1f50a963a24d usr.bin/quota/quota.c
--- a/usr.bin/quota/quota.c     Thu Dec 16 23:52:51 1999 +0000
+++ b/usr.bin/quota/quota.c     Thu Dec 16 23:54:46 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quota.c,v 1.21 1998/08/25 20:59:39 ross Exp $  */
+/*     $NetBSD: quota.c,v 1.21.2.1 1999/12/16 23:54:46 he Exp $        */
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)quota.c    8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: quota.c,v 1.21 1998/08/25 20:59:39 ross Exp $");
+__RCSID("$NetBSD: quota.c,v 1.21.2.1 1999/12/16 23:54:46 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -190,9 +190,9 @@
 {
 
        fprintf(stderr, "%s\n%s\n%s\n",
-               "Usage: quota [-guqv]",
-               "\tquota [-qv] -u username ...",
-               "\tquota [-qv] -g groupname ...");
+           "Usage: quota [-guqv]",
+           "\tquota [-qv] -u username ...",
+           "\tquota [-qv] -g groupname ...");
        exit(1);
 }
 
@@ -350,7 +350,8 @@
                            >= qup->dqblk.dqb_bsoftlimit) {
                                if (qup->dqblk.dqb_btime > now)
                                        msgb = "In block grace period on";
-                               else    msgb = "Over block quota on";
+                               else
+                                       msgb = "Over block quota on";
                        }
                }
                if (qflag) {
@@ -373,21 +374,24 @@
                                printf("%s\n", qup->fsname);
                                nam = "";
                        } 
-                       printf("%15s%8d%c%7d%8d%8s"
-                               , nam
-                               , dbtob(qup->dqblk.dqb_curblocks) / 1024
-                               , (msgb == (char *)0) ? ' ' : '*'
-                               , dbtob(qup->dqblk.dqb_bsoftlimit) / 1024
-                               , dbtob(qup->dqblk.dqb_bhardlimit) / 1024
-                               , (msgb == (char *)0) ? ""
-                                   : timeprt(qup->dqblk.dqb_btime));
+                       printf("%12s%9d%c%8d%9d%8s"
+                           , nam
+                           , (int)(dbtob((u_quad_t)qup->dqblk.dqb_curblocks)
+                               / 1024)
+                           , (msgb == (char *)0) ? ' ' : '*'
+                           , (int)(dbtob((u_quad_t)qup->dqblk.dqb_bsoftlimit)
+                               / 1024)
+                           , (int)(dbtob((u_quad_t)qup->dqblk.dqb_bhardlimit)
+                               / 1024)
+                           , (msgb == (char *)0) ? ""
+                               : timeprt(qup->dqblk.dqb_btime));
                        printf("%8d%c%7d%8d%8s\n"
-                               , qup->dqblk.dqb_curinodes
-                               , (msgi == (char *)0) ? ' ' : '*'
-                               , qup->dqblk.dqb_isoftlimit
-                               , qup->dqblk.dqb_ihardlimit
-                               , (msgi == (char *)0) ? ""
-                                   : timeprt(qup->dqblk.dqb_itime)
+                           , qup->dqblk.dqb_curinodes
+                           , (msgi == (char *)0) ? ' ' : '*'
+                           , qup->dqblk.dqb_isoftlimit
+                           , qup->dqblk.dqb_ihardlimit
+                           , (msgi == (char *)0) ? ""
+                               : timeprt(qup->dqblk.dqb_itime)
                        );
                        continue;
                }
@@ -406,16 +410,16 @@
        printf("Disk quotas for %s %s (%cid %ld): %s\n", qfextension[type],
            name, *qfextension[type], (u_long)id, tag);
        if (!qflag && tag[0] == '\0') {
-               printf("%15s%8s %7s%8s%8s%8s %7s%8s%8s\n"
-                       , "Filesystem"
-                       , "blocks"
-                       , "quota"
-                       , "limit"
-                       , "grace"
-                       , "files"
-                       , "quota"
-                       , "limit"
-                       , "grace"
+               printf("%12s%9s %8s%9s%8s%8s %7s%8s%8s\n"
+                   , "Filesystem"
+                   , "blocks"
+                   , "quota"
+                   , "limit"
+                   , "grace"
+                   , "files"
+                   , "quota"
+                   , "limit"
+                   , "grace"
                );
        }
 }



Home | Main Index | Thread Index | Old Index