summaryrefslogtreecommitdiffstats
path: root/sbin/mount
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2006-06-02 17:53:46 +0000
committerrodrigc <rodrigc@FreeBSD.org>2006-06-02 17:53:46 +0000
commitf6f16a30433d481e93fba5c15e08761f5159b2c5 (patch)
treeb386f643810066e9b92eacc11056ddf774290f1b /sbin/mount
parentf3fbf567eebcd9d412f248b267d3e8ae2e1d206e (diff)
downloadFreeBSD-src-f6f16a30433d481e93fba5c15e08761f5159b2c5.zip
FreeBSD-src-f6f16a30433d481e93fba5c15e08761f5159b2c5.tar.gz
Fix "mount -u -o ro".
Requested by: maxim
Diffstat (limited to 'sbin/mount')
-rw-r--r--sbin/mount/mount.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index fc03a8b..e1c4e8a 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -184,6 +184,26 @@ exec_mountprog(const char *name, const char *execname,
return (0);
}
+static
+int specified_ro(const char *arg)
+{
+ char *optbuf, *opt;
+ int ret = 0;
+
+ optbuf = strdup(arg);
+ if (optbuf == NULL)
+ err(1, NULL);
+
+ for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) {
+ if (strcmp(opt, "ro") == 0) {
+ ret = 1;
+ break;
+ }
+ }
+ free(optbuf);
+ return (ret);
+}
+
int
main(int argc, char *argv[])
{
@@ -215,8 +235,11 @@ main(int argc, char *argv[])
init_flags |= MNT_FORCE;
break;
case 'o':
- if (*optarg)
+ if (*optarg) {
options = catopt(options, optarg);
+ if (specified_ro(optarg))
+ ro = 1;
+ }
break;
case 'p':
fstab_style = 1;
OpenPOWER on IntegriCloud