diff options
author | Denys Vlasenko | 2017-08-05 01:38:55 +0200 |
---|---|---|
committer | Denys Vlasenko | 2017-08-05 01:40:12 +0200 |
commit | 0b16a67959244125ca495f5b7f389d14183c468e (patch) | |
tree | 61156701f22490e0bf427c05ceea4291fde6ec91 | |
parent | 4989d05174efd267d2fd85dc2e7f7beaafb8ab37 (diff) | |
download | busybox-0b16a67959244125ca495f5b7f389d14183c468e.zip busybox-0b16a67959244125ca495f5b7f389d14183c468e.tar.gz |
svc: fix a case where with more than option, getopt() state is not reset
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | runit/sv.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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; |