diff options
| -rw-r--r-- | usr.bin/find/find.h | 2 | ||||
| -rw-r--r-- | usr.bin/find/function.c | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/find/find.h b/usr.bin/find/find.h index 3a78e9ee6a0..8763f60c858 100644 --- a/usr.bin/find/find.h +++ b/usr.bin/find/find.h @@ -67,6 +67,7 @@ typedef struct _plandata { } ex; char *_a_data[2]; /* array of char pointers */ char *_c_data; /* char pointer */ + int _m_flags; /* mount flage for fstype */ } p_un; #define a_data p_un._a_data #define c_data p_un._c_data @@ -81,6 +82,7 @@ typedef struct _plandata { #define e_argv p_un.ex._e_argv #define e_orig p_un.ex._e_orig #define e_len p_un.ex._e_len +#define m_flags p_un._m_flags } PLAN; #include "extern.h" diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c index 510a0d1145b..08cd151424b 100644 --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -320,8 +320,7 @@ f_fstype(plan, entry) { static dev_t curdev; /* need a guaranteed illegal dev value */ static int first = 1; - struct statfs sb; - static short val; + static struct statfs sb; char *p, save[2]; /* only check when we cross mount point */ @@ -355,10 +354,9 @@ f_fstype(plan, entry) } first = 0; - val = plan->flags == MOUNT_NONE ? sb.f_flags : sb.f_type; } return(plan->flags == MOUNT_NONE ? - val & MNT_LOCAL : val == plan->flags); + sb.f_flags & plan->m_flags : sb.f_type == plan->flags); } PLAN * @@ -380,6 +378,7 @@ c_fstype(arg) case 'l': if (!strcmp(arg, "local")) { new->flags = MOUNT_NONE; + new->m_flags = MNT_LOCAL; return(new); } break; @@ -399,6 +398,13 @@ c_fstype(arg) return(new); } break; + case 'r': + if (!strcmp(arg, "rdonly")) { + new->flags = MOUNT_NONE; + new->m_flags = MNT_RDONLY; + return(new); + } + break; case 'u': if (!strcmp(arg, "ufs")) { new->flags = MOUNT_UFS; |
