svc: fix a case where with more than option, getopt() state is not reset
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
9f59849daa
commit
754e9f96de
11
runit/sv.c
11
runit/sv.c
@ -718,15 +718,16 @@ int svc_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
argv[1] = command;
|
argv[1] = command;
|
||||||
command[1] = '\0';
|
command[1] = '\0';
|
||||||
|
|
||||||
/* getopt32() was already called:
|
|
||||||
* reset the libc getopt() function, which keeps internal state.
|
|
||||||
*/
|
|
||||||
GETOPT_RESET();
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (opts & 1) {
|
if (opts & 1) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
command[0] = *optstring;
|
command[0] = *optstring;
|
||||||
|
|
||||||
|
/* getopt() was already called by getopt32():
|
||||||
|
* reset the libc getopt() function's internal state.
|
||||||
|
*/
|
||||||
|
GETOPT_RESET();
|
||||||
r = sv(argv);
|
r = sv(argv);
|
||||||
if (r)
|
if (r)
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user