On 08/27/2014 05:02 PM, Pádraig Brady wrote: > On 08/27/2014 04:13 PM, Fridolin Pokorny wrote: >> diff --git a/src/df.c b/src/df.c >> index e907b94..156c7c1 100644 >> --- a/src/df.c >> +++ b/src/df.c >> @@ -622,11 +622,11 @@ filter_mount_list (bool devices_only) >> struct devlist *devlist; >> struct mount_entry *discard_me = NULL; >> >> - /* TODO: On Linux we might avoid this stat() and another in get_dev() >> - by using the device IDs available from /proc/self/mountinfo. >> - read_file_system_list() could populate me_dev from those >> - for efficiency and accuracy. */ >> +#ifdef _linux_ >> + if (me->me_dev == (dev_t) -1 && stat (me->me_mountdir, &buf) == -1) >> +#else >> if (-1 == stat (me->me_mountdir, &buf)) >> +#endif > > Do we need the ifdef at all? > Won't me_dev be -1 or valid? > > Also this should include a test that sets up some > loopback mounts in a chroot to demonstrate the > functionality difference.
BTW tests/df/skip-duplicates.sh emulates getmntent() so that will probably have to be adjusted also. thanks, Pádraig.
