Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/quotaon As the quota type comes from the kernel and...



details:   https://anonhg.NetBSD.org/src/rev/2095168ef6cf
branches:  trunk
changeset: 365818:2095168ef6cf
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Apr 26 15:39:00 2022 +0000

description:
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.

diffstat:

 usr.sbin/quotaon/quotaon.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (47 lines):

diff -r 6dbe14bd8f4b -r 2095168ef6cf usr.sbin/quotaon/quotaon.c
--- a/usr.sbin/quotaon/quotaon.c        Tue Apr 26 15:37:25 2022 +0000
+++ b/usr.sbin/quotaon/quotaon.c        Tue Apr 26 15:39:00 2022 +0000
@@ -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 @@
 #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 @@
     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 @@
                        }
                        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;
 }



Home | Main Index | Thread Index | Old Index