summaryrefslogtreecommitdiffstats
path: root/usr.sbin/quotaon
diff options
context:
space:
mode:
authordm <dm@openbsd.org>1997-06-04 04:18:37 +0000
committerdm <dm@openbsd.org>1997-06-04 04:18:37 +0000
commitc25ff6d6a4451cf7db9f3608eb70c4d57bed0a66 (patch)
treec0e3b28d7b965301a04e6934444f2809f75454b5 /usr.sbin/quotaon
parentuse bzero instead of FD_ZERO (diff)
downloadwireguard-openbsd-c25ff6d6a4451cf7db9f3608eb70c4d57bed0a66.tar.xz
wireguard-openbsd-c25ff6d6a4451cf7db9f3608eb70c4d57bed0a66.zip
Dumped core.
Diffstat (limited to 'usr.sbin/quotaon')
-rw-r--r--usr.sbin/quotaon/quotaon.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/quotaon/quotaon.c b/usr.sbin/quotaon/quotaon.c
index 8091b32ac7c..4579d6f5ec8 100644
--- a/usr.sbin/quotaon/quotaon.c
+++ b/usr.sbin/quotaon/quotaon.c
@@ -42,7 +42,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)quotaon.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: quotaon.c,v 1.8 1997/01/17 07:14:19 millert Exp $";
+static char *rcsid = "$Id: quotaon.c,v 1.9 1997/06/04 04:18:37 dm Exp $";
#endif /* not lint */
/*
@@ -121,19 +121,23 @@ main(argc, argv)
strcmp(fs->fs_vfstype, "mfs"))
continue;
if (aflag) {
- if (gflag && hasquota(fs, GRPQUOTA, &qfnp))
+ if (gflag && hasquota(fs, GRPQUOTA, &qfnp, 0))
errs += quotaonoff(fs, offmode, GRPQUOTA, qfnp);
- if (uflag && hasquota(fs, USRQUOTA, &qfnp))
+ if (uflag && hasquota(fs, USRQUOTA, &qfnp, 0))
errs += quotaonoff(fs, offmode, USRQUOTA, qfnp);
continue;
}
if ((argnum = oneof(fs->fs_file, argv, argc)) >= 0 ||
(argnum = oneof(fs->fs_spec, argv, argc)) >= 0) {
done |= 1 << argnum;
- if (gflag)
+ if (gflag) {
+ hasquota(fs, GRPQUOTA, &qfnp, 1);
errs += quotaonoff(fs, offmode, GRPQUOTA, qfnp);
- if (uflag)
+ }
+ if (uflag) {
+ hasquota(fs, USRQUOTA, &qfnp, 1);
errs += quotaonoff(fs, offmode, USRQUOTA, qfnp);
+ }
}
}
endfsent();
@@ -158,7 +162,6 @@ quotaonoff(fs, offmode, type, qfpathname)
int offmode, type;
char *qfpathname;
{
-
if (strcmp(fs->fs_file, "/") && readonly(fs))
return (1);
if (offmode) {
@@ -200,10 +203,11 @@ oneof(target, list, cnt)
/*
* Check to see if a particular quota is to be enabled.
*/
-hasquota(fs, type, qfnamep)
+hasquota(fs, type, qfnamep, force)
register struct fstab *fs;
int type;
char **qfnamep;
+ int force;
{
register char *opt;
char *cp;
@@ -224,7 +228,7 @@ hasquota(fs, type, qfnamep)
if (type == GRPQUOTA && strcmp(opt, grpname) == 0)
break;
}
- if (!opt)
+ if (!force && !opt)
return (0);
if (cp) {
*qfnamep = cp;