summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2022-11-01 11:42:19 +0100
committerJan Kara <jack@suse.cz>2022-11-01 11:42:19 +0100
commit037eaa6037789a3fac082ca1d6e240073943ca1a (patch)
treedc021e9edd1ff98e747448e377c60c063ad222aa
parentbd94d7170e9ce2a9da9b9f51d8525adee7536c33 (diff)
downloadlinuxquota-037eaa6037789a3fac082ca1d6e240073943ca1a.tar.gz
setquota: Avoid false error messages when setting grace times
When setting grace times for a user with only inodes or blocks over softlimit, setquota(8) was wrongly complaining about not being able to set the grace time of the non-exceeded entity although it was left unset. Silence this bogus error message. Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--setquota.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/setquota.c b/setquota.c
index 993d920..c517ab1 100644
--- a/setquota.c
+++ b/setquota.c
@@ -494,11 +494,13 @@ static int setindivgraces(struct quota_handle **handles)
return -1;
}
for (q = curprivs; q; q = q->dq_next) {
- if (q->dq_dqb.dqb_bsoftlimit && toqb(q->dq_dqb.dqb_curspace) > q->dq_dqb.dqb_bsoftlimit)
+ if (!toset.dqb_btime ||
+ (q->dq_dqb.dqb_bsoftlimit && toqb(q->dq_dqb.dqb_curspace) > q->dq_dqb.dqb_bsoftlimit))
q->dq_dqb.dqb_btime = toset.dqb_btime;
else
errstr(_("Not setting block grace time on %s because softlimit is not exceeded.\n"), q->dq_h->qh_quotadev);
- if (q->dq_dqb.dqb_isoftlimit && q->dq_dqb.dqb_curinodes > q->dq_dqb.dqb_isoftlimit)
+ if (!toset.dqb_itime ||
+ (q->dq_dqb.dqb_isoftlimit && q->dq_dqb.dqb_curinodes > q->dq_dqb.dqb_isoftlimit))
q->dq_dqb.dqb_itime = toset.dqb_itime;
else
errstr(_("Not setting inode grace time on %s because softlimit is not exceeded.\n"), q->dq_h->qh_quotadev);