aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-05-29 06:29:12 -0500
committerRob Landley <rob@landley.net>2014-05-29 06:29:12 -0500
commitc6fcf1d25da72a45d59a3791062bd5241034eb8a (patch)
treeb470196722c68f756904d90ebfe8317167fa5988 /toys/other
parentdc640259adff6007d195fd4cc78dcf9829e5e6ee (diff)
downloadtoybox-c6fcf1d25da72a45d59a3791062bd5241034eb8a.tar.gz
Make "losetup /dev/loop0 filename" work.
Sigh. Implement the complex cases and you screw up the simple cases you already tested...
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/losetup.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/toys/other/losetup.c b/toys/other/losetup.c
index 618016e1..aad722e4 100644
--- a/toys/other/losetup.c
+++ b/toys/other/losetup.c
@@ -179,10 +179,13 @@ void losetup_main(void)
} else {
char *file = (toys.optflags & (FLAG_d|FLAG_c)) ? NULL : toys.optargs[1];
- if (!toys.optc || (file && toys.optc>1)) {
+ if (!toys.optc || (file && toys.optc != 2)) {
toys.exithelp++;
- perror_exit("needs 1 arg");
+ perror_exit("needs %d arg%s", 1+!!file, file ? "s" : "");
+ }
+ for (s = toys.optargs; *s; s++) {
+ loopback_setup(*s, file);
+ if (file) break;
}
- for (s = toys.optargs; *s; s++) loopback_setup(*s, file);
}
}