summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-07-09 00:46:39 +0100
committerPádraig Brady <P@draigBrady.com>2013-07-09 02:36:27 +0100
commit616fa9c7b335117243c0c157a6c45445e20fdfa0 (patch)
tree6bcd9572f2e7aa362638be64b9021104be6dbdda /src
parent8d2da3f58a82bd1813ca5c06f5692ad60a00559c (diff)
downloadcoreutils-616fa9c7b335117243c0c157a6c45445e20fdfa0.tar.xz
df: fix mount list processing with unstatable mount dirs
* src/df.c (filter_mount_list): Initialize devlist->dev_num correctly when unable to stat() a mount point. This will avoid possible invalid deduplication done on the list due to use of uninitialized memory. * tests/df/skip-duplicates.sh: Ensure this code path is exercised. Also refactor the test to be table driven. * NEWS: Mention the bug fix.
Diffstat (limited to 'src')
-rw-r--r--src/df.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/df.c b/src/df.c
index 051513196..bc507c72e 100644
--- a/src/df.c
+++ b/src/df.c
@@ -620,7 +620,8 @@ filter_mount_list (void)
if (-1 == stat (me->me_mountdir, &buf))
{
- ; /* Stat failed - add ME to be able to complain about it later. */
+ /* Stat failed - add ME to be able to complain about it later. */
+ buf.st_dev = me->me_dev;
}
else
{