aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb
diff options
context:
space:
mode:
Diffstat (limited to 'toys/lsb')
-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);
}
}