diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-05-12 14:49:13 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-05-13 23:23:30 +0100 |
commit | cbfb34c7d32e888b39e03a51a374ed664e9fa31b (patch) | |
tree | ff66b3e76041157c883fcc9db8f3f1dfbed22ce2 /src | |
parent | fb902297f536df060ff10ef06bb8fe6cfe0c845e (diff) | |
download | coreutils-cbfb34c7d32e888b39e03a51a374ed664e9fa31b.tar.xz |
df: ignore non file system entries in /proc/mounts
Linux with network namespaces contains entries in /proc/mounts like:
proc net:[4026532464] proc rw,nosuid,nodev,noexec,relatime 0 0
resulting in a failure to stat 'net:[...]', inducing a warning
and an exit with failure status.
* src/df.c (get_dev): Ignore all relative mount points.
* tests/df/skip-duplicates.sh: Add an entry to test relative dirs.
Diffstat (limited to 'src')
-rw-r--r-- | src/df.c | 5 |
1 files changed, 5 insertions, 0 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, |