diff options
-rw-r--r-- | src/df.c | 5 | ||||
-rwxr-xr-x | tests/df/skip-duplicates.sh | 3 |
2 files changed, 7 insertions, 1 deletions
@@ -853,6 +853,11 @@ get_dev (char const *disk, char const *mount_point, char const* file, if (!selected_fstype (fstype) || excluded_fstype (fstype)) return; + /* Ignore relative MOUNT_POINTs, which are present for example + in /proc/mounts on Linux with network namespaces. */ + if (!force_fsu && mount_point && ! IS_ABSOLUTE_FILE_NAME (mount_point)) + return; + /* If MOUNT_POINT is NULL, then the file system is not mounted, and this program reports on the file system that the special file is on. It would be better to report on the unmounted file system, diff --git a/tests/df/skip-duplicates.sh b/tests/df/skip-duplicates.sh index d872f27fc..44f7d4ca7 100755 --- a/tests/df/skip-duplicates.sh +++ b/tests/df/skip-duplicates.sh @@ -56,6 +56,7 @@ struct mntent *getmntent (FILE *fp) {.mnt_fsname="/fsname", .mnt_dir="/"}, {.mnt_fsname="virtfs", .mnt_dir="/NONROOT"}, {.mnt_fsname="virtfs", .mnt_dir="/NONROOT"}, + {.mnt_fsname="netns", .mnt_dir="net:[1234567]"}, }; if (done == 1) @@ -68,7 +69,7 @@ struct mntent *getmntent (FILE *fp) if (done == 1 && !getenv ("CU_TEST_DUPE_INVALID")) done++; /* skip the first entry. */ - while (done++ <= 6) + while (done++ <= 7) { mntents[done-2].mnt_type = "-"; if (STREQ (mntents[done-2].mnt_dir, "/NONROOT")) |