summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-05-24 14:43:21 +0000
committerJim Meyering <jim@meyering.net>1997-05-24 14:43:21 +0000
commit90721ff4a4719ed63da4dd63e144bedf6f9aafe6 (patch)
treebc0108fa2d7ce72305db9ead4e7ef58741810514 /lib
parent1024238089471588bc2edead3529746e7b62287d (diff)
downloadcoreutils-90721ff4a4719ed63da4dd63e144bedf6f9aafe6.tar.xz
(read_filesystem_list): Show automount-related
duplicate filesystems only when --all specified. With suggestions from Stuart Kemp.
Diffstat (limited to 'lib')
-rw-r--r--lib/mountlist.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/mountlist.c b/lib/mountlist.c
index aeb716ef1..cc5edac3f 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -1,5 +1,5 @@
/* mountlist.c -- return a list of mounted filesystems
- Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -99,6 +99,17 @@ void error ();
# define MOUNTED_GETMNTTBL
#endif
+#ifdef HAVE_SYS_MNTENT_H
+/* This is to get MNTOPT_IGNORE on e.g. SVR4. */
+# include <sys/mntent.h>
+#endif
+
+#if defined (MNTOPT_IGNORE) && defined (HAVE_HASMNTOPT)
+# define MNT_IGNORE(M) hasmntopt ((M), MNTOPT_IGNORE)
+#else
+# define MNT_IGNORE(M) 0
+#endif
+
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
/* Return the value of the hexadecimal number represented by CP.
No prefix (like '0x') or suffix (like 'h') is expected to be
@@ -502,6 +513,10 @@ read_filesystem_list (need_fs_type, all_fs)
while ((ret = getmntent (fp, &mnt)) == 0)
{
+ /* Don't show automounted filesystems twice on e.g., Solaris. */
+ if (!all_fs && MNT_IGNORE (&mnt))
+ continue;
+
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
me->me_devname = xstrdup (mnt.mnt_special);
me->me_mountdir = xstrdup (mnt.mnt_mountp);