From 9d736f8dbfef2b33d431dccf852dace9cfc84d59 Mon Sep 17 00:00:00 2001 From: Pádraig Brady
Date: Wed, 4 Jun 2014 00:09:11 +0100
Subject: 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
---
tests/df/skip-duplicates.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
(limited to 'tests')
diff --git a/tests/df/skip-duplicates.sh b/tests/df/skip-duplicates.sh
index a620e7320..9f0f749fe 100755
--- a/tests/df/skip-duplicates.sh
+++ b/tests/df/skip-duplicates.sh
@@ -96,8 +96,8 @@ test -f x || skip_ "internal test failure: maybe LD_PRELOAD doesn't work?"
LD_PRELOAD=./k.so df -T >out || fail=1
test $(wc -l