diff options
author | Sean Eric Fagan <sef@FreeBSD.org> | 2019-02-07 21:51:39 +0000 |
---|---|---|
committer | Sean Eric Fagan <sef@FreeBSD.org> | 2019-02-07 21:51:39 +0000 |
commit | 148d31b83dc0a536da6f3011bd8c2da994fa53f5 (patch) | |
tree | 31a3e974fa4bea23f288c883068d8b6d8889aa5f /lib/libutil | |
parent | 10e3bebf9e4d5ec481b3e48ad3c70b0b58a43df4 (diff) | |
download | src-148d31b83dc0a536da6f3011bd8c2da994fa53f5.tar.gz src-148d31b83dc0a536da6f3011bd8c2da994fa53f5.zip |
r339008 broke repquota for UFS. This rectifies that.
Refactor the function calls and tests so that, on UFS, the proper fields
are filled out.
PR: 233849
Reported by: Andre Albsmeier
Reviewed by: mav, delphij
MFC after: 1 month
Sponsored by: iXsystems Inc
Differential Revision: https://reviews.freebsd.org/D18785
Notes
Notes:
svn path=/head/; revision=343881
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/quotafile.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/libutil/quotafile.c b/lib/libutil/quotafile.c index b460c5d1453e..a985a1dc81a7 100644 --- a/lib/libutil/quotafile.c +++ b/lib/libutil/quotafile.c @@ -119,6 +119,7 @@ quota_open(struct fstab *fs, int quotatype, int openflags) struct group *grp; struct stat st; int qcmd, serrno; + int ufs; if ((qf = calloc(1, sizeof(*qf))) == NULL) return (NULL); @@ -129,15 +130,21 @@ quota_open(struct fstab *fs, int quotatype, int openflags) goto error; qf->dev = st.st_dev; qcmd = QCMD(Q_GETQUOTASIZE, quotatype); + ufs = strcmp(fs->fs_vfstype, "ufs") == 0; + /* + * On UFS, hasquota() fills in qf->qfname. But we only care about + * this for UFS. So we need to call hasquota() for UFS, first. + */ + if (ufs) { + serrno = hasquota(fs, quotatype, qf->qfname, + sizeof(qf->qfname)); + } if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0) return (qf); - /* We only check the quota file for ufs */ - if (strcmp(fs->fs_vfstype, "ufs")) { + if (!ufs) { errno = 0; goto error; - } - serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname)); - if (serrno == 0) { + } else if (serrno == 0) { errno = EOPNOTSUPP; goto error; } |