aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/find
diff options
context:
space:
mode:
authorTai-hwa Liang <avatar@FreeBSD.org>2011-06-13 05:22:07 +0000
committerTai-hwa Liang <avatar@FreeBSD.org>2011-06-13 05:22:07 +0000
commit6ab780e5f056c3c24aff9ff95d314c7e8a961f24 (patch)
tree73378a0c59f739c2d1560f8588d18f653f791b7f /usr.bin/find
parent76170c392dda5b4979dc04816d88a8859f5fe621 (diff)
downloadsrc-6ab780e5f056c3c24aff9ff95d314c7e8a961f24.tar.gz
src-6ab780e5f056c3c24aff9ff95d314c7e8a961f24.zip
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 <mwisnicki+freebsd@gmail.com> MFC after: 1 month
Notes
Notes: svn path=/head/; revision=223035
Diffstat (limited to 'usr.bin/find')
-rw-r--r--usr.bin/find/function.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index 26c022c59ba0..eabb0549f73c 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -846,7 +846,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)
@@ -888,13 +889,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();
}
@@ -905,22 +906,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")) {
@@ -938,12 +928,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;
}