aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb/umount.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-12-19 21:38:12 -0600
committerRob Landley <rob@landley.net>2013-12-19 21:38:12 -0600
commit6db8529a785e2cab142e840b6e3fbdcc2c02dd1f (patch)
treee22a0b2025f7848f05bcd4f5ed22b57956ef84ea /toys/lsb/umount.c
parentbb5cfb270f924390c2163573cc5ed8fba9f638b8 (diff)
downloadtoybox-6db8529a785e2cab142e840b6e3fbdcc2c02dd1f.tar.gz
Don't permute toys.optargs, cleanup code (xexec()) can free it.
Diffstat (limited to 'toys/lsb/umount.c')
-rw-r--r--toys/lsb/umount.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toys/lsb/umount.c b/toys/lsb/umount.c
index 51f3024d..bcc1fff1 100644
--- a/toys/lsb/umount.c
+++ b/toys/lsb/umount.c
@@ -91,7 +91,7 @@ static void do_umount(char *dir, int flags)
return;
}
if (toys.optflags & FLAG_r) {
- if (!mount("", *toys.optargs, "", MS_REMOUNT|MS_RDONLY, "")) {
+ if (!mount("", dir, "", MS_REMOUNT|MS_RDONLY, "")) {
if (toys.optflags & FLAG_v) printf("%s remounted ro", dir);
return;
}
@@ -102,6 +102,7 @@ static void do_umount(char *dir, int flags)
void umount_main(void)
{
int flags=0;
+ char **optargs;
if (!toys.optc && !(toys.optflags & FLAG_a))
error_exit("Need 1 arg or -a");
@@ -109,7 +110,7 @@ void umount_main(void)
if (toys.optflags & FLAG_f) flags |= MNT_FORCE;
if (toys.optflags & FLAG_l) flags |= MNT_DETACH;
- for (; *toys.optargs; toys.optargs++) do_umount(*toys.optargs, flags);
+ for (optargs = toys.optargs; *optargs; optargs++) do_umount(*optargs, flags);
if (toys.optflags & FLAG_a) {
struct mtab_list *mlsave, *ml;