Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Mar 2019 03:00:33 +0000 (UTC)
From:      Sean Eric Fagan <sef@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r344997 - stable/12/lib/libutil
Message-ID:  <201903110300.x2B30XnL038461@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903110300.x2B30XnL038461>