svn commit: r343881 - head/lib/libutil
Bryan Drewery
bdrewery at FreeBSD.org
Thu Feb 7 22:00:57 UTC 2019
On 2/7/19 1:51 PM, Sean Eric Fagan wrote:
> Author: sef
> Date: Thu Feb 7 21:51:39 2019
> New Revision: 343881
> URL: https://svnweb.freebsd.org/changeset/base/343881
>
> Log:
> 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
>
> Modified:
> head/lib/libutil/quotafile.c
>
> Modified: head/lib/libutil/quotafile.c
> ==============================================================================
> --- head/lib/libutil/quotafile.c Thu Feb 7 21:41:27 2019 (r343880)
> +++ head/lib/libutil/quotafile.c Thu Feb 7 21:51:39 2019 (r343881)
> @@ -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;
> }
>
/usr/src/lib/libutil/quotafile.c:121: warning: 'serrno' may be used
uninitialized in this function
--
Regards,
Bryan Drewery
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20190207/2a56a196/attachment.sig>
More information about the svn-src-all
mailing list