aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-02-25 18:03:08 -0600
committerRob Landley <rob@landley.net>2016-02-25 18:03:08 -0600
commit8fffeffdf259bc1a7c2c8055a0bbc3f4c508ed76 (patch)
treecc2726627692793f4cc3710ee9915234a629f2df
parentfd6c94753f072df405126272a6d48d93dabe42a6 (diff)
downloadtoybox-8fffeffdf259bc1a7c2c8055a0bbc3f4c508ed76.tar.gz
Fix bug where mount -o leftover string didn't get passed through to kernel
for 2-argument version.
-rw-r--r--toys/lsb/mount.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/toys/lsb/mount.c b/toys/lsb/mount.c
index 9510c5e9..525d0ab1 100644
--- a/toys/lsb/mount.c
+++ b/toys/lsb/mount.c
@@ -5,6 +5,7 @@
* See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/mount.html
* Note: -hV is bad spec, haven't implemented -FsLU yet
* no mtab (/proc/mounts does it) so -n is NOP.
+ * TODO mount -o loop,autoclear (linux git 96c5865559ce)
USE_MOUNT(NEWTOY(mount, "?O:afnrvwt:o*[-rw]", TOYFLAG_BIN|TOYFLAG_STAYROOT))
//USE_NFSMOUNT(NEWTOY(nfsmount, "?<2>2", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_STAYROOT))
@@ -13,7 +14,7 @@ config MOUNT
bool "mount"
default y
help
- usage: mount [-afFrsvw] [-t TYPE] [-o OPTIONS...] [[DEVICE] DIR]
+ usage: mount [-afFrsvw] [-t TYPE] [-o OPTION,] [[DEVICE] DIR]
Mount new filesystem(s) on directories. With no arguments, display existing
mounts.
@@ -197,7 +198,7 @@ static void mount_filesystem(char *dev, char *dir, char *type,
for (;;) {
rc = mount(dev, dir, type, flags, opts);
// Did we succeed, fail unrecoverably, or already try read-only?
- if (rc == 0 || (errno != EACCES && errno != EROFS) || (flags&MS_RDONLY))
+ if (!rc || (errno != EACCES && errno != EROFS) || (flags&MS_RDONLY))
break;
// If we haven't already tried it, use the BLKROSET ioctl to ensure
// that the underlying device isn't read-only.
@@ -207,7 +208,7 @@ static void mount_filesystem(char *dev, char *dir, char *type,
if (-1 != (fd = open(dev, O_RDONLY))) {
rc = ioctl(fd, BLKROSET, &ro);
close(fd);
- if (rc == 0) continue;
+ if (!rc) continue;
}
}
fprintf(stderr, "'%s' is read-only\n", dev);
@@ -375,7 +376,8 @@ void mount_main(void)
} else {
char *more = 0;
- mount_filesystem(dev, dir, TT.type, flag_opts(opts, flags, &more), more);
+ flags = flag_opts(opts, flags, &more);
+ mount_filesystem(dev, dir, TT.type, flags, more);
if (CFG_TOYBOX_FREE) free(more);
}
}