Module Name:    src
Committed By:   hannken
Date:           Tue Apr 26 15:39:00 UTC 2022

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

Log Message:
As the quota type comes from the kernel and is only valid when
quota is on get the type before quota_off and after quota_on.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/quotaon/quotaon.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/quotaon/quotaon.c
diff -u src/usr.sbin/quotaon/quotaon.c:1.30 src/usr.sbin/quotaon/quotaon.c:1.31
--- src/usr.sbin/quotaon/quotaon.c:1.30	Sat Apr  7 05:07:33 2012
+++ src/usr.sbin/quotaon/quotaon.c	Tue Apr 26 15:39:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotaon.c,v 1.30 2012/04/07 05:07:33 christos Exp $	*/
+/*	$NetBSD: quotaon.c,v 1.31 2022/04/26 15:39:00 hannken Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)quotaon.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: quotaon.c,v 1.30 2012/04/07 05:07:33 christos Exp $");
+__RCSID("$NetBSD: quotaon.c,v 1.31 2022/04/26 15:39:00 hannken Exp $");
 #endif
 #endif /* not lint */
 
@@ -217,12 +217,14 @@ quotaonoff(struct fstab *fs, struct quot
     int warn_on_enxio, const char *fsspec)
 {
 	const char *mode = (offmode == 1) ? "off" : "on";
+	const char *type;
 
 	if (strcmp(fs->fs_file, "/") && readonly(fs, fsspec)) {
 		return 1;
 	}
 
 	if (offmode) {
+		type = quota_idtype_getname(qh, idtype);
 		if (quota_quotaoff(qh, idtype)) {
 			if (warn_on_enxio || errno != ENXIO) {
 				warn("quota%s for %s", mode, fs->fs_file);
@@ -236,11 +238,12 @@ quotaonoff(struct fstab *fs, struct quot
 			}
 			return 1;
 		}
+		type = quota_idtype_getname(qh, idtype);
 	}
 
 	if (vflag) {
 		printf("%s: %s quotas turned %s\n",
-		    fs->fs_file, quota_idtype_getname(qh, idtype), mode);
+		    fs->fs_file, type, mode);
 	}
 	return 0;
 }

Reply via email to