svn commit: r344997 - stable/12/lib/libutil
Sean Eric Fagan
sef at FreeBSD.org
Mon Mar 11 03:00:34 UTC 2019
Author: sef
Date: Mon Mar 11 03:00:33 2019
New Revision: 344997
URL: https://svnweb.freebsd.org/changeset/base/344997
Log:
MFC r343881
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
Modified:
stable/12/lib/libutil/quotafile.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/lib/libutil/quotafile.c
==============================================================================
--- stable/12/lib/libutil/quotafile.c Mon Mar 11 02:57:00 2019 (r344996)
+++ stable/12/lib/libutil/quotafile.c Mon Mar 11 03:00:33 2019 (r344997)
@@ -119,6 +119,7 @@ quota_open(struct fstab *fs, int quotatype, int openfl
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 openfl
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;
}
More information about the svn-src-all
mailing list