]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_quota: check report_mount return value
authorEric Sandeen <sandeen@sandeen.net>
Mon, 30 May 2016 02:21:31 +0000 (12:21 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 30 May 2016 02:21:31 +0000 (12:21 +1000)
commita8b6f5274724ea2413d40f452f58874a36b78499
tree8bb4028bdfb13c424b140ffc22dd0f1c54d5163b
parent1b1b5359243e741f9fdba6acf5a0c7f0d80b9979
xfs_quota: check report_mount return value

The new call to report_mount doesn't check the return value
like every other caller does...

Returning 1 means it printed something; if the terse flag
is used and there is no usage, nothing gets printed.
If we set the NO_HEADER_FLAG anyway, then we won't see
the header for subsequent entries as we expect.

For example, project ID 0 has no usage in this case:

# xfs_quota -x -c "report -a" /mnt/test
Project quota on /mnt/test (/dev/sdb1)
                               Blocks
Project ID       Used       Soft       Hard    Warn/Grace
---------- --------------------------------------------------
#0                  0          0          0     00 [--------]
project          2048          4          4     00 [--none--]

So using the terse flag results in no header when it prints
projects with usage:

# xfs_quota -x -c "report -t -a" /mnt/test
project          2048          4          4     00 [--none--]

With this fix it prints the header as expected:

# xfs_quota -x -c "report -t -a" /mnt/test
Project quota on /mnt/test (/dev/sdb1)
                               Blocks
Project ID       Used       Soft       Hard    Warn/Grace
---------- --------------------------------------------------
project          2048          4          4     00 [--none--]

Addresses-Coverity-Id: 1361552
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
quota/report.c