aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb/mount.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-09-28 13:15:41 -0500
committerRob Landley <rob@landley.net>2014-09-28 13:15:41 -0500
commit679a21d674cf487992c0ccabc8666c417e59d390 (patch)
tree6fdaa9ab3716003f97fbec9dda4f62479b8c187e /toys/lsb/mount.c
parent562af2c0f2f4bd8420a26560f1816b6a81ac417e (diff)
downloadtoybox-679a21d674cf487992c0ccabc8666c417e59d390.tar.gz
mount: terminate list so unknown user mount attempts don't endlessly loop, add better error reporting.
Diffstat (limited to 'toys/lsb/mount.c')
-rw-r--r--toys/lsb/mount.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/toys/lsb/mount.c b/toys/lsb/mount.c
index 39d98caf..28db97d7 100644
--- a/toys/lsb/mount.c
+++ b/toys/lsb/mount.c
@@ -71,6 +71,7 @@ GLOBALS(
// TODO work out how that differs from "mount -ar"
// TODO what if you --bind mount a block device somewhere (file, dir, dev)
// TODO "touch servername; mount -t cifs servername path"
+// TODO mount -o remount a user mount
// Strip flags out of comma separated list of options, return flags,.
static long flag_opts(char *new, long flags, char **more)
@@ -82,7 +83,6 @@ static long flag_opts(char *new, long flags, char **more)
// NOPs (we autodetect --loop and --bind)
{"loop", 0}, {"bind", 0}, {"defaults", 0}, {"quiet", 0},
{"user", 0}, {"nouser", 0}, // checked in fstab, ignored in -o
-// {"noauto", 0}, {"swap", 0},
{"ro", MS_RDONLY}, {"rw", ~MS_RDONLY},
{"nosuid", MS_NOSUID}, {"suid", ~MS_NOSUID},
{"nodev", MS_NODEV}, {"dev", ~MS_NODEV},
@@ -275,7 +275,7 @@ void mount_main(void)
// Do we need to do an /etc/fstab trawl?
// This covers -a, -o remount, one argument, all user mounts
if ((toys.optflags & FLAG_a) || (dev && (!dir || getuid() || remount))) {
- if (!remount) mtl = xgetmountlist("/etc/fstab");
+ if (!remount) dlist_terminate(mtl = xgetmountlist("/etc/fstab"));
for (mm = remount ? remount : mtl; mm; mm = (remount ? mm->prev : mm->next))
{
@@ -311,6 +311,9 @@ void mount_main(void)
if (!(toys.optflags & FLAG_a)) break;
}
if (CFG_TOYBOX_FREE) llist_traverse(mtl, free);
+ if (!mm && !(toys.optflags & FLAG_a))
+ error_exit("'%s' not in %s", dir ? dir : dev,
+ remount ? "/proc/mounts" : "fstab");
// show mounts from /proc/mounts
} else if (!dev) {