diff options
Diffstat (limited to 'toys/other/losetup.c')
-rw-r--r-- | toys/other/losetup.c | 9 |
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); } } |