From 8fffeffdf259bc1a7c2c8055a0bbc3f4c508ed76 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 25 Feb 2016 18:03:08 -0600 Subject: Fix bug where mount -o leftover string didn't get passed through to kernel for 2-argument version. --- toys/lsb/mount.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'toys/lsb') 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); } } -- cgit v1.2.3