svn commit: r351730 - stable/11/lib/libutil
Sean Eric Fagan
sef at FreeBSD.org
Tue Sep 3 04:50:40 UTC 2019
Author: sef
Date: Tue Sep 3 04:50:39 2019
New Revision: 351730
URL: https://svnweb.freebsd.org/changeset/base/351730
Log:
MFC r343881, r343882
r339008 broke repquota for UFS. This rectifies that.
PR: 233849
Modified:
stable/11/lib/libutil/quotafile.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/lib/libutil/quotafile.c
==============================================================================
--- stable/11/lib/libutil/quotafile.c Tue Sep 3 04:16:30 2019 (r351729)
+++ stable/11/lib/libutil/quotafile.c Tue Sep 3 04:50:39 2019 (r351730)
@@ -116,7 +116,8 @@ quota_open(struct fstab *fs, int quotatype, int openfl
struct dqhdr64 dqh;
struct group *grp;
struct stat st;
- int qcmd, serrno;
+ int qcmd, serrno = 0;
+ int ufs;
if ((qf = calloc(1, sizeof(*qf))) == NULL)
return (NULL);
@@ -127,15 +128,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-stable
mailing list