Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/mount Remove puffs| from vfstype before making comparis...



details:   https://anonhg.NetBSD.org/src/rev/cfe559ef9771
branches:  trunk
changeset: 750803:cfe559ef9771
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Jan 14 21:46:24 2010 +0000

description:
Remove puffs| from vfstype before making comparison to determine if
fs is mounted.

Fixes slightly-miscategorized kern/37626.

diffstat:

 sbin/mount/mount.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r a2cd0f6bd4ff -r cfe559ef9771 sbin/mount/mount.c
--- a/sbin/mount/mount.c        Thu Jan 14 21:38:19 2010 +0000
+++ b/sbin/mount/mount.c        Thu Jan 14 21:46:24 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mount.c,v 1.90 2010/01/14 21:30:17 pooka Exp $ */
+/*     $NetBSD: mount.c,v 1.91 2010/01/14 21:46:24 pooka Exp $ */
 
 /*
  * Copyright (c) 1980, 1989, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)mount.c    8.25 (Berkeley) 5/8/95";
 #else
-__RCSID("$NetBSD: mount.c,v 1.90 2010/01/14 21:30:17 pooka Exp $");
+__RCSID("$NetBSD: mount.c,v 1.91 2010/01/14 21:46:24 pooka Exp $");
 #endif
 #endif /* not lint */
 
@@ -400,13 +400,23 @@
                        return (1);
                }
                for(i = 0; i < numfs; i++) {
+                       const char *mountedtype = sfp[i].f_fstypename;
+                       size_t cmplen = sizeof(sfp[i].f_fstypename);
+
+                       /* remove "puffs|" from comparisons, if present */
+#define TYPESIZE (sizeof(PUFFS_TYPEPREFIX)-1)
+                       if (strncmp(mountedtype,
+                           PUFFS_TYPEPREFIX, TYPESIZE) == 0) {
+                               mountedtype += TYPESIZE;
+                               cmplen -= TYPESIZE;
+                       }
+
                        /*
                         * XXX can't check f_mntfromname,
                         * thanks to mfs, union, etc.
                         */
                        if (strncmp(name, sfp[i].f_mntonname, MNAMELEN) == 0 &&
-                           strncmp(vfstype, sfp[i].f_fstypename,
-                               sizeof(sfp[i].f_fstypename)) == 0) {
+                           strncmp(vfstype, mountedtype, cmplen) == 0) {
                                if (verbose)
                                        (void)printf("%s on %s type %.*s: "
                                            "%s\n",



Home | Main Index | Thread Index | Old Index