diff options
author | mpp <mpp@FreeBSD.org> | 2008-01-15 06:33:20 +0000 |
---|---|---|
committer | mpp <mpp@FreeBSD.org> | 2008-01-15 06:33:20 +0000 |
commit | 24232b615d41fb5e5e7a5ee56691f4caeacdf216 (patch) | |
tree | f562a02129c788ce89893a7733cd7679441ded5f /sbin/quotacheck | |
parent | 0454875168679c2685d654c75bc3728da2da422d (diff) | |
download | FreeBSD-src-24232b615d41fb5e5e7a5ee56691f4caeacdf216.zip FreeBSD-src-24232b615d41fb5e5e7a5ee56691f4caeacdf216.tar.gz |
Quotacheck may possibly skip quota accounting for up to 2 files
on a filesystem if the quota data files reside on a different
filesystem (e.g. the userquota=/somepath,groupquota=/somepath2
options are specified in /etc/fstab to place the quota files
somewhere other than the default location).
Fix quotacheck to only skip accounting if the quota data file
actually resides on the filesystem being checked.
Diffstat (limited to 'sbin/quotacheck')
-rw-r--r-- | sbin/quotacheck/quotacheck.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c index 1956184..7e4c026 100644 --- a/sbin/quotacheck/quotacheck.c +++ b/sbin/quotacheck/quotacheck.c @@ -275,6 +275,7 @@ chkquota(fsname, mntpt, qnp) union dinode *dp; int cg, i, mode, errs = 0; ino_t ino, inosused, userino = 0, groupino = 0; + dev_t dev, userdev = 0, groupdev = 0; char *cp; struct stat sb; @@ -282,6 +283,11 @@ chkquota(fsname, mntpt, qnp) warn("%s", fsname); return (1); } + if ((stat(mntpt, &sb)) < 0) { + warn("%s", mntpt); + return (1); + } + dev = sb.st_dev; if (vflag) { (void)printf("*** Checking "); if (qnp->flags & HASUSR) @@ -292,12 +298,16 @@ chkquota(fsname, mntpt, qnp) (void)printf(" quotas for %s (%s)\n", fsname, mntpt); } if (qnp->flags & HASUSR) { - if (stat(qnp->usrqfname, &sb) == 0) + if (stat(qnp->usrqfname, &sb) == 0) { userino = sb.st_ino; + userdev = sb.st_dev; + } } if (qnp->flags & HASGRP) { - if (stat(qnp->grpqfname, &sb) == 0) + if (stat(qnp->grpqfname, &sb) == 0) { groupino = sb.st_ino; + groupdev = sb.st_dev; + } } sync(); dev_bsize = 1; @@ -379,7 +389,8 @@ chkquota(fsname, mntpt, qnp) if (DIP(dp, di_flags) & SF_SNAPSHOT) continue; #endif - if (ino == userino || ino == groupino) + if ((ino == userino && dev == userdev) || + (ino == groupino && dev == groupdev)) continue; if (qnp->flags & HASGRP) { fup = addid((u_long)DIP(dp, di_gid), GRPQUOTA, |