summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-06-19 12:11:00 +0100
committerPádraig Brady <P@draigBrady.com>2014-06-24 14:39:34 +0100
commitb7bb499496ff306d87a07ffd68c034f29b97bc37 (patch)
treee6621e0f9e4bcef9413c9fed54d9c82087456d00 /src
parent6635f0b0f71f68ab4e9108091bc6049ddb143648 (diff)
downloadcoreutils-b7bb499496ff306d87a07ffd68c034f29b97bc37.tar.xz
du: ignore directory cycles due to bind mounts
* src/du.c (process_file): Treat cycles due to bind mounts like cycles due to following symlinks. * tests/du/bind-mount-dir-cycle.sh: Adjust accordingly. * NEWS: Mention the change in behavior. Reported at http://bugzilla.redhat.com/836557
Diffstat (limited to 'src')
-rw-r--r--src/du.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/du.c b/src/du.c
index e4509fd78..0966326b5 100644
--- a/src/du.c
+++ b/src/du.c
@@ -514,15 +514,11 @@ process_file (FTS *fts, FTSENT *ent)
break;
case FTS_DC:
- if (cycle_warning_required (fts, ent))
+ /* If not following symlinks and not a (bind) mount point. */
+ if (cycle_warning_required (fts, ent)
+ && ! di_set_lookup (di_mnt, sb->st_dev, sb->st_ino))
{
- /* If this is a mount point, then diagnose it and avoid
- the cycle. */
- if (di_set_lookup (di_mnt, sb->st_dev, sb->st_ino))
- error (0, 0, _("mount point %s already traversed"),
- quote (file));
- else
- emit_cycle_warning (file);
+ emit_cycle_warning (file);
return false;
}
return true;