diff options
author | Pádraig Brady <P@draigBrady.com> | 2013-12-04 00:50:10 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2013-12-04 13:17:17 +0000 |
commit | 2091f44993c4d0ad16cbe272c247bb452ae74216 (patch) | |
tree | 3fe1e3c3d2d4ef7e1dbd0dc10f9500ced0b27edf /src | |
parent | 33660b4973baf66423207615bef0d277ca7a5938 (diff) | |
download | coreutils-2091f44993c4d0ad16cbe272c247bb452ae74216.tar.xz |
df: handle bind mounts when processing device nodes
* src/df.c (get_disk): Use the same heuristic used in
get_point() to select the shortest file system mount point,
in an attempt to show the base mounted file system.
* NEWS: Mention the bug fix.
Diffstat (limited to 'src')
-rw-r--r-- | src/df.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1062,10 +1062,21 @@ get_disk (char const *disk) if (resolved && resolved[0] == '/') disk = resolved; + size_t best_match_len = SIZE_MAX; for (me = mount_list; me; me = me->me_next) { if (STREQ (disk, me->me_devname)) - best_match = me; + { + size_t len = strlen (me->me_mountdir); + if (len < best_match_len) + { + best_match = me; + if (len == 1) /* Traditional root. */ + break; + else + best_match_len = len; + } + } } free (resolved); |