summaryrefslogtreecommitdiff
path: root/src/df.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-04-05 18:21:38 +0100
committerPádraig Brady <P@draigBrady.com>2015-04-13 09:20:55 +0100
commit1b1c40e1d6f8cf30b6c7c9d31bbddbc3d5cc72e6 (patch)
treeb6f887d9e98343fc3e0389de18dc7b4abc30b51e /src/df.c
parent74bf6670eb54377f3aec98ef24a3b5f45e3ac554 (diff)
downloadcoreutils-1b1c40e1d6f8cf30b6c7c9d31bbddbc3d5cc72e6.tar.xz
df: fix --local hanging with inaccessible remote mounts
* src/df.c (filter_mount_list): With -l, avoid stating remote mounts. * init.cfg: Avoid test hangs with inaccessible remote mounts. * tests/df/no-mtab-status.sh: Skip with inaccessible remote mounts. * tests/df/skip-rootfs.sh: Likewise. * tests/df/total-verify.sh: Likewise. * NEWS: Mention the bug fix. Reported at http://bugzilla.redhat.com/1199679
Diffstat (limited to 'src/df.c')
-rw-r--r--src/df.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/df.c b/src/df.c
index 38566811c..9d4c02740 100644
--- a/src/df.c
+++ b/src/df.c
@@ -622,13 +622,16 @@ filter_mount_list (bool devices_only)
struct devlist *devlist;
struct mount_entry *discard_me = NULL;
- /* TODO: On Linux we might avoid this stat() and another in get_dev()
+ /* Avoid stating remote file systems as that may hang.
+ TODO: On Linux we might avoid this stat() and another in get_dev()
by using the device IDs available from /proc/self/mountinfo.
read_file_system_list() could populate me_dev from those
for efficiency and accuracy. */
- if (-1 == stat (me->me_mountdir, &buf))
+ if ((me->me_remote && show_local_fs)
+ || -1 == stat (me->me_mountdir, &buf))
{
- /* Stat failed - add ME to be able to complain about it later. */
+ /* If remote, and showing just local, add ME for filtering later.
+ If stat failed; add ME to be able to complain about it later. */
buf.st_dev = me->me_dev;
}
else