[git commit branch/1_27_stable] svc: fix a case where with more than option, getopt() state is not reset
Denys Vlasenko
vda.linux at googlemail.com
Fri Aug 4 23:40:12 UTC 2017
commit: https://git.busybox.net/busybox/commit/?id=0b16a67959244125ca495f5b7f389d14183c468e
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/1_27_stable
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
runit/sv.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/runit/sv.c b/runit/sv.c
index faa31d4..b398156 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -718,15 +718,16 @@ int svc_main(int argc UNUSED_PARAM, char **argv)
argv[1] = command;
command[1] = '\0';
- /* getopt32() was already called:
- * reset the libc getopt() function, which keeps internal state.
- */
- GETOPT_RESET();
-
do {
if (opts & 1) {
int r;
+
command[0] = *optstring;
+
+ /* getopt() was already called by getopt32():
+ * reset the libc getopt() function's internal state.
+ */
+ GETOPT_RESET();
r = sv(argv);
if (r)
return 1;
More information about the busybox-cvs
mailing list