]> git.ipfire.org Git - thirdparty/coreutils.git/commit
df: output placeholder values for inaccessible mount points
authorPádraig Brady <P@draigBrady.com>
Tue, 3 Jun 2014 23:09:11 +0000 (00:09 +0100)
committerPádraig Brady <P@draigBrady.com>
Tue, 24 Jun 2014 16:38:46 +0000 (17:38 +0100)
commit9d736f8dbfef2b33d431dccf852dace9cfc84d59
tree5c3d5ff5b8e9e2d04276f389361007688f54a8e4
parentb7bb499496ff306d87a07ffd68c034f29b97bc37
df: output placeholder values for inaccessible mount points

A system provided mount entry may be unavailable due to TOCTOU race,
or if another device has been over-mounted at that position, or due to
access permissions.  In all these cases output "-" placeholder values
rather than either producing an error, or in the over-mount case
outputting values for the wrong device.

* src/df.c (device_list): A new global list now updated by
filter_mount_list().
(filter_mount_list): Adjust to take a parameter as to whether
update the global mount list, or only the mount <-> device ID mapping.
(get_dev): Use the device ID mapping to ensure we're not outputting
stats for the wrong device.  Also output placeholder values when we
can't access a system specified mount point.
(get_all_entries): Set the DEVICE_ONLY param for filter_mount_list().
(devname_for_dev): A new function to search the mount <-> dev mapping.
* test/df/skip-duplicates.sh: Adjust accordingly.
* NEWS: Mention the bug fixes.

Discussed at: http://bugs.gnu.org/16539
NEWS
src/df.c
tests/df/skip-duplicates.sh