summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2002-02-22 13:54:54 +0000
committerjkar8572 <jkar8572>2002-02-22 13:54:54 +0000
commit4207cd66eda721e7b6f896585d1e2187717e91b7 (patch)
tree7d61596a17f227e0df231998ea0a2b47c650a73a
parente55c4e2567e2439c80755f49257883bfefebd018 (diff)
quotaon(8) returns reasonable exit code in 'print state' mode
-rw-r--r--Changelog2
-rw-r--r--quotaon.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/Changelog b/Changelog
index 021abd7..9d7b184 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,6 @@
Changes in quota-tools from 3.03 to 3.04
* added -D_FILE_OFFSET_BITS=64 to Makefile - fixes problems with large files with some libcs (Michael Meskes)
-* added -p (print state) to quotaon
+* added -p (print state) to quotaon (Vladimir Linek, Jan Kara)
Changes in quota-tools from 3.02 to 3.03
diff --git a/quotaon.c b/quotaon.c
index a2eb26f..b749037 100644
--- a/quotaon.c
+++ b/quotaon.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quotaon.c,v 1.10 2002/01/07 22:24:20 jkar8572 Exp $"
+#ident "$Id: quotaon.c,v 1.11 2002/02/22 13:54:54 jkar8572 Exp $"
/*
* Turn quota on/off for a filesystem.
@@ -99,7 +99,7 @@ static int newstate(struct mntent *mnt, int offmode, int type, char *extra)
}
/* Print state of quota (on/off) */
-static void print_state(struct mntent *mnt, int type)
+static int print_state(struct mntent *mnt, int type)
{
int on = 0;
@@ -114,6 +114,8 @@ static void print_state(struct mntent *mnt, int type)
printf("%s quota on %s (%s) is %s\n", type2name(type), mnt->mnt_dir, mnt->mnt_fsname,
on ? "on" : "off");
+
+ return on;
}
int main(int argc, char **argv)
@@ -189,9 +191,9 @@ int main(int argc, char **argv)
}
else {
if (gflag)
- print_state(mnt, GRPQUOTA);
+ errs += print_state(mnt, GRPQUOTA);
if (uflag)
- print_state(mnt, USRQUOTA);
+ errs += print_state(mnt, USRQUOTA);
}
}
end_mounts_scan();