From ee88227c33bae40f5488c1d61969eed1e668186b Mon Sep 17 00:00:00 2001 From: sin Date: Tue, 18 Mar 2014 16:19:56 +0200 Subject: [PATCH] Don't list dummy rootfs by default --- df.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/df.c b/df.c index dc3411f..299c297 100644 --- a/df.c +++ b/df.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "util.h" @@ -18,9 +19,11 @@ main(int argc, char *argv[]) { struct mntent *me = NULL; FILE *fp; + int aflag = 0; ARGBEGIN { case 'a': + aflag = 1; break; case 's': case 'h': @@ -35,8 +38,12 @@ main(int argc, char *argv[]) fp = setmntent("/proc/mounts", "r"); if (!fp) eprintf("setmntent %s:", "/proc/mounts"); - while ((me = getmntent(fp)) != NULL) + while ((me = getmntent(fp)) != NULL) { + if (aflag == 0) + if (strcmp(me->mnt_type, "rootfs") == 0) + continue; mnt_show(me->mnt_fsname, me->mnt_dir); + } endmntent(fp); return EXIT_SUCCESS;