On 10/12/05, Paul Eggert <[EMAIL PROTECTED]> wrote:
> No, people don't want to be able to see proc mounts by default. But
> for proc mounts, fsu.fsu_blocks should be zero so the following code
> in show_dev should prevent the mount from being listed:
>
> if (fsu.fsu_blocks == 0 && !show_all_fs && !show_listed_fs)
> return;
>
> Can you please investigate why that isn't happening for you?
> I'm worried that your fix masks out a more-fundamental bug.
> Thanks.
>
Hi,
I found that simply when the user has no permissions to access the
mount directory, statfs will return an error (errno = EACCES).
df then reports this error.
The attached patch should fix this.
n0dalus.
Index: src/df.c
===================================================================
RCS file: /cvsroot/coreutils/coreutils/src/df.c,v
retrieving revision 1.168
diff -p -d -U6 -r1.168 df.c
--- src/df.c 16 Aug 2005 20:33:40 -0000 1.168
+++ src/df.c 12 Oct 2005 06:10:18 -0000
@@ -297,12 +297,14 @@ show_dev (char const *disk, char const *
but statfs doesn't do that on most systems. */
if (!stat_file)
stat_file = mount_point ? mount_point : disk;
if (get_fs_usage (stat_file, disk, &fsu))
{
+ if(errno == EACCES && !show_all_fs && !show_listed_fs)
+ return; /* Ignore mount points we can't access */
error (0, errno, "%s", quote (stat_file));
exit_status = EXIT_FAILURE;
return;
}
if (fsu.fsu_blocks == 0 && !show_all_fs && !show_listed_fs)
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils