diff options
author | Jan Kara <jack@suse.cz> | 2024-05-07 12:55:30 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2024-05-07 13:00:24 +0200 |
commit | dba8c5ca95516b9550fc44b2a476ceca60ee4b38 (patch) | |
tree | 35e1a44fd46334d39e90aedc549a1d8902c9a64e | |
parent | c41dbb51e5426d7dc204943a5676320685f61520 (diff) |
quotaio_xfs: Fix error handling in xfs_read_dquot()
When quotactl(2) fails, xfs_read_dquot() will happily return zero-filled
structure. This is fine when the user structure does not exist but it is
wrong when there's other error (like EACCESS). Fix the error handling.
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | quotaio_xfs.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/quotaio_xfs.c b/quotaio_xfs.c index d742f9c..040e7d8 100644 --- a/quotaio_xfs.c +++ b/quotaio_xfs.c @@ -176,7 +176,12 @@ static struct dquot *xfs_read_dquot(struct quota_handle *h, qid_t id) qcmd = QCMD(Q_XFS_GETQUOTA, h->qh_type); if (do_quotactl(qcmd, h->qh_quotadev, h->qh_dir, id, (void *)&xdqblk) < 0) { - ; + /* + * ENOENT means the structure just does not exist - return all + * zeros. Otherwise return failure. + */ + if (errno != ENOENT) + return NULL; } else { xfs_kern2utildqblk(&dquot->dq_dqb, &xdqblk); |