]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs: xfs_quota: don't print invalid quota file inode number
authorAlex Elder <aelder@sgi.com>
Wed, 28 Sep 2011 11:15:37 +0000 (11:15 +0000)
committerAlex Elder <aelder@sgi.com>
Thu, 29 Sep 2011 14:33:26 +0000 (09:33 -0500)
When the state of quota files is dumped, xfs_quota blindly shows
whatever inode number is returned by the kernel.  If one of the
quota types is not enabled or enforced, the inode number provided
is an invalid value ((__u64) -1).  Rather than print a meaningless
large integer, print "N/A" in its place to make interpreting the
result it a little more obvious.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
quota/state.c

index 3862e677ff8a0898e0e7cda614a7aba1fea0e9f0..42bffc0179157422daafb86e383bf384a8c9ff99 100644 (file)
@@ -122,10 +122,13 @@ state_qfilestat(
                mount->fs_dir, mount->fs_name);
        fprintf(fp, _("  Accounting: %s\n"), accounting ? _("ON") : _("OFF"));
        fprintf(fp, _("  Enforcement: %s\n"), enforcing ? _("ON") : _("OFF"));
-       fprintf(fp, _("  Inode: #%llu (%llu blocks, %lu extents)\n"),
-               (unsigned long long)qfs->qfs_ino,
-               (unsigned long long)qfs->qfs_nblks,
-               (unsigned long)qfs->qfs_nextents);
+       if (qfs->qfs_ino != (__u64) -1)
+               fprintf(fp, _("  Inode: #%llu (%llu blocks, %lu extents)\n"),
+                       (unsigned long long)qfs->qfs_ino,
+                       (unsigned long long)qfs->qfs_nblks,
+                       (unsigned long)qfs->qfs_nextents);
+       else
+               fprintf(fp, _("  Inode: N/A\n"));
 }
 
 static void