Module Name:    src
Committed By:   dholland
Date:           Mon Aug 13 23:08:58 UTC 2012

Modified Files:
        src/usr.sbin/edquota: edquota.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/edquota/edquota.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/edquota/edquota.c
diff -u src/usr.sbin/edquota/edquota.c:1.48 src/usr.sbin/edquota/edquota.c:1.49
--- src/usr.sbin/edquota/edquota.c:1.48	Mon Aug 13 22:21:05 2012
+++ src/usr.sbin/edquota/edquota.c	Mon Aug 13 23:08:58 2012
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #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 @@ getprivs(long id, int defaultq, int idty
 	int nfst, i;
 	struct quotalist *qlist;
 	struct quotause *qup;
+	int seenany = 0;
 
 	qlist = quotalist_create();
 
@@ -488,6 +489,7 @@ getprivs(long id, int defaultq, int idty
 	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 @@ getprivs(long id, int defaultq, int idty
 		quotalist_append(qlist, qup);
 	}
 
+	if (!seenany) {
+		errx(1, "No mounted filesystems have quota support");
+	}
+
 #if 0
 	if (filesys && quotalist_empty(qlist)) {
 		if (defaultq)

Reply via email to