]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(show_point): Before accepting an entry as a match, make sure that
authorJim Meyering <jim@meyering.net>
Thu, 23 Nov 2000 15:36:58 +0000 (15:36 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 23 Nov 2000 15:36:58 +0000 (15:36 +0000)
the mount directory exists and has the required device number.
Before, e.g., `df /floppy' would mistakenly report on the root
partition if /floppy were not listed in /etc/mtab but / was.
Patch from Eirik Fuller (http://bugs.debian.org/76923).

src/df.c

index 3979dac5393e23fecc1b2a0c0ff3c41a5012487b..ad49e4244a64ae75dccbafadba9604c834fd36da 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -612,7 +612,9 @@ show_point (const char *point, const struct stat *statp)
            }
       }
 
-    if (best_match && !STREQ (best_match->me_type, "lofs"))
+    if (best_match && !STREQ (best_match->me_type, "lofs")
+       && stat (best_match->me_mountdir, &disk_stats) == 0
+       && disk_stats.st_dev == statp->st_dev)
       {
        me = best_match;
        goto show_me;