From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 18 04:54:13 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B27E106564A; Mon, 18 Jul 2011 04:54:13 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4004A8FC14; Mon, 18 Jul 2011 04:54:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6I4sDRt006440; Mon, 18 Jul 2011 04:54:13 GMT (envelope-from avatar@svn.freebsd.org) Received: (from avatar@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6I4sDam006438; Mon, 18 Jul 2011 04:54:13 GMT (envelope-from avatar@svn.freebsd.org) Message-Id: <201107180454.p6I4sDam006438@svn.freebsd.org> From: Tai-hwa Liang Date: Mon, 18 Jul 2011 04:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224173 - stable/8/usr.bin/find X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2011 04:54:13 -0000 Author: avatar Date: Mon Jul 18 04:54:12 2011 New Revision: 224173 URL: http://svn.freebsd.org/changeset/base/224173 Log: MFC r223035: Using statfs.f_fstypename rather than statfs.f_type whilst performing fstype comparsion as nullfs will copy f_type from underlayer FS. PR: bin/156258 Submitted by: Marcin Wisnicki Modified: stable/8/usr.bin/find/function.c Directory Properties: stable/8/usr.bin/find/ (props changed) Modified: stable/8/usr.bin/find/function.c ============================================================================== --- stable/8/usr.bin/find/function.c Mon Jul 18 03:40:49 2011 (r224172) +++ stable/8/usr.bin/find/function.c Mon Jul 18 04:54:12 2011 (r224173) @@ -851,7 +851,8 @@ f_fstype(PLAN *plan, FTSENT *entry) static dev_t curdev; /* need a guaranteed illegal dev value */ static int first = 1; struct statfs sb; - static int val_type, val_flags; + static int val_flags; + static char fstype[sizeof(sb.f_fstypename)]; char *p, save[2] = {0,0}; if ((plan->flags & F_MTMASK) == F_MTUNKNOWN) @@ -893,13 +894,13 @@ f_fstype(PLAN *plan, FTSENT *entry) * always copy both of them. */ val_flags = sb.f_flags; - val_type = sb.f_type; + strlcpy(fstype, sb.f_fstypename, sizeof(fstype)); } switch (plan->flags & F_MTMASK) { case F_MTFLAG: return val_flags & plan->mt_data; case F_MTTYPE: - return val_type == plan->mt_data; + return (strncmp(fstype, plan->c_data, sizeof(fstype)) == 0); default: abort(); } @@ -910,22 +911,11 @@ c_fstype(OPTION *option, char ***argvp) { char *fsname; PLAN *new; - struct xvfsconf vfc; fsname = nextarg(option, argvp); ftsoptions &= ~FTS_NOSTAT; new = palloc(option); - - /* - * Check first for a filesystem name. - */ - if (getvfsbyname(fsname, &vfc) == 0) { - new->flags |= F_MTTYPE; - new->mt_data = vfc.vfc_typenum; - return new; - } - switch (*fsname) { case 'l': if (!strcmp(fsname, "local")) { @@ -943,12 +933,8 @@ c_fstype(OPTION *option, char ***argvp) break; } - /* - * We need to make filesystem checks for filesystems - * that exists but aren't in the kernel work. - */ - fprintf(stderr, "Warning: Unknown filesystem type %s\n", fsname); - new->flags |= F_MTUNKNOWN; + new->flags |= F_MTTYPE; + new->c_data = fsname; return new; }