diff options
author | Petr Písař <ppisar@redhat.com> | 2018-07-16 11:22:53 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2019-03-21 13:40:06 +0100 |
commit | e62c91309dd3687cede46f2f773feecb394b44c0 (patch) | |
tree | e0a70cd174b3033121ea875eadd76a11ea86c861 /quota.c | |
parent | c687c8e1f85625e0928a9cf9aabb423b09f7aca3 (diff) | |
download | linuxquota-e62c91309dd3687cede46f2f773feecb394b44c0.tar.gz |
quota(1): Distinguish between none quota limits and no allocated resources
If a user does not occupy any space or inodes on a file system but
quota limits are set, quota(1) tool still reports "none":
# quota -u test
Disk quotas for user test (uid 500): none
That's because the tool skips printing details for file systems
without any used resources. The message is also used for a file
system without any quota limits which is confusing at times.
This patch makes the distinction and changes "none" message into "no
quota limits set" and "no limited resources used" respectively.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'quota.c')
-rw-r--r-- | quota.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -188,7 +188,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt) char timebuf[MAXTIMELEN]; char name[MAXNAMELEN]; struct quota_handle **handles; - int lines = 0, bover, iover, over; + int lines = 0, bover, iover, over, unlimited; time_t now; time(&now); @@ -204,11 +204,16 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt) goto out_handles; } over = 0; + unlimited = 1; for (q = qlist; q; q = q->dq_next) { bover = iover = 0; - if (!(flags & FL_VERBOSE) && !q->dq_dqb.dqb_isoftlimit && !q->dq_dqb.dqb_ihardlimit - && !q->dq_dqb.dqb_bsoftlimit && !q->dq_dqb.dqb_bhardlimit) - continue; + if (!q->dq_dqb.dqb_isoftlimit && !q->dq_dqb.dqb_ihardlimit + && !q->dq_dqb.dqb_bsoftlimit && !q->dq_dqb.dqb_bhardlimit) { + if (!(flags & FL_VERBOSE)) + continue; + } else { + unlimited = 0; + } msgi = NULL; if (q->dq_dqb.dqb_ihardlimit && q->dq_dqb.dqb_curinodes >= q->dq_dqb.dqb_ihardlimit) { msgi = _("File limit reached on"); @@ -300,7 +305,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt) } } if (!(flags & FL_QUIET) && !lines && qlist) - heading(type, id, name, _("none")); + heading(type, id, name, unlimited ? _("none") : _("no limited resources used")); freeprivs(qlist); out_handles: dispose_handle_list(handles); |