mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
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.
This commit is contained in:
1 parent
33660b4973
commit
2091f44993
2 files changed
+16
-1
No files matched your search
@@ -12,6 +12,10 @@ GNU coreutils NEWS -*- outline -*-
|
||||
df displayed the symlink's device rather than that for the device node.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
df now processes disk device nodes correctly in the presence of bind mounts.
|
||||
Now df shows the base mounted file system rather than the last one mounted.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
install now removes the target file if the strip program failed for any
|
||||
reason. Before, that file was left behind, sometimes even with wrong
|
||||
permissions.
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user