Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/edquota Bail out early if none of the mounted volum...



details:   https://anonhg.NetBSD.org/src/rev/62b4f0b7a22b
branches:  trunk
changeset: 780977:62b4f0b7a22b
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Aug 13 23:08:58 2012 +0000

description:
Bail out early if none of the mounted volumes support quotas. Avoids a
null print in interactive use.

diffstat:

 usr.sbin/edquota/edquota.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r d0488106d752 -r 62b4f0b7a22b usr.sbin/edquota/edquota.c
--- a/usr.sbin/edquota/edquota.c        Mon Aug 13 22:21:05 2012 +0000
+++ b/usr.sbin/edquota/edquota.c        Mon Aug 13 23:08:58 2012 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: edquota.c,v 1.48 2012/08/13 22:21:05 dholland Exp $ */
+/*      $NetBSD: edquota.c,v 1.49 2012/08/13 23:08:58 dholland Exp $ */
 /*
  * Copyright (c) 1980, 1990, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "from: @(#)edquota.c    8.3 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: edquota.c,v 1.48 2012/08/13 22:21:05 dholland Exp $");
+__RCSID("$NetBSD: edquota.c,v 1.49 2012/08/13 23:08:58 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -478,6 +478,7 @@
        int nfst, i;
        struct quotalist *qlist;
        struct quotause *qup;
+       int seenany = 0;
 
        qlist = quotalist_create();
 
@@ -488,6 +489,7 @@
        for (i = 0; i < nfst; i++) {
                if ((fst[i].f_flag & ST_QUOTA) == 0)
                        continue;
+               seenany = 1;
                if (filesys &&
                    strcmp(fst[i].f_mntonname, filesys) != 0 &&
                    strcmp(fst[i].f_mntfromname, filesys) != 0)
@@ -513,6 +515,10 @@
                quotalist_append(qlist, qup);
        }
 
+       if (!seenany) {
+               errx(1, "No mounted filesystems have quota support");
+       }
+
 #if 0
        if (filesys && quotalist_empty(qlist)) {
                if (defaultq)



Home | Main Index | Thread Index | Old Index