summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authoreschrock <none@none>2005-08-19 11:56:37 -0700
committereschrock <none@none>2005-08-19 11:56:37 -0700
commitb72c1761d7573be4804f5a97918dcb6d97eedfa5 (patch)
tree1dbd7a7a0cb08496b8e5fb5a3288fe0096fb8cad /usr
parent8c1a37169a24b27841d468d8ee412f6d286ab3ed (diff)
downloadillumos-joyent-b72c1761d7573be4804f5a97918dcb6d97eedfa5.tar.gz
6307489 getmntany() should not stat meaningless special devices
Diffstat (limited to 'usr')
-rw-r--r--usr/src/lib/libc/port/gen/getmntent.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr/src/lib/libc/port/gen/getmntent.c b/usr/src/lib/libc/port/gen/getmntent.c
index f60748766e..cc66039326 100644
--- a/usr/src/lib/libc/port/gen/getmntent.c
+++ b/usr/src/lib/libc/port/gen/getmntent.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -123,7 +123,12 @@ getmntany(FILE *fp, struct mnttab *mgetp, struct mnttab *mrefp)
dev_t brdev;
struct stat64 statb;
- if (mrefp->mnt_special && stat64(mrefp->mnt_special, &statb) == 0 &&
+ /*
+ * Ignore specials that don't correspond to real devices to avoid doing
+ * unnecessary lookups in stat64().
+ */
+ if (mrefp->mnt_special && mrefp->mnt_special[0] == '/' &&
+ stat64(mrefp->mnt_special, &statb) == 0 &&
((bmode = (statb.st_mode & S_IFMT)) == S_IFBLK ||
bmode == S_IFCHR)) {
bstat = 1;