aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-06-15 21:06:02 +0200
committerDuncaen <mail@duncano.de>2017-06-15 21:06:55 +0200
commitd076cb6279b059a46a34d46a4577f2a9f141035c (patch)
treef8971b2a4fb323031ef6d95b4b0343d2e54251d0
parent66d931479ee07220b42914e7af4ec43ea52fdd75 (diff)
downloadlobase-d076cb6279b059a46a34d46a4577f2a9f141035c.tar.gz
bin/df: skip filesystems without blocks on linux like the cgroup subdirs
-rw-r--r--bin/df/df.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/df/df.c b/bin/df/df.c
index 1011099..63fc292 100644
--- a/bin/df/df.c
+++ b/bin/df/df.c
@@ -321,6 +321,11 @@ prtstat(struct statfs *sfsp, int maxwidth, int headerlen, int blocksize)
u_int64_t used, inodes;
int64_t availblks;
+#if __linux__
+ if (sfsp->f_blocks == 0)
+ return;
+#endif
+
(void)printf("%-*.*s", maxwidth, maxwidth, sfsp->f_mntfromname);
used = sfsp->f_blocks - sfsp->f_bfree;
availblks = sfsp->f_bavail + used;
@@ -407,6 +412,10 @@ posixprint(struct statfs *mntbuf, long mntsize, int maxwidth)
for (i = 0; i < mntsize; i++) {
sfsp = &mntbuf[i];
+#if __linux__
+ if (sfsp->f_blocks == 0)
+ continue;
+#endif
used = sfsp->f_blocks - sfsp->f_bfree;
avail = sfsp->f_bavail + used;
if (avail == 0)