From b72c1761d7573be4804f5a97918dcb6d97eedfa5 Mon Sep 17 00:00:00 2001 From: eschrock Date: Fri, 19 Aug 2005 11:56:37 -0700 Subject: 6307489 getmntany() should not stat meaningless special devices --- usr/src/lib/libc/port/gen/getmntent.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'usr/src') 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; -- cgit v1.2.3