Merge pull request #127 from ifupdown-ng/bugfix/multicall-getopt
multicall: fix inappropriate use of getopt in the multicall stub
This commit is contained in:
commit
6730db5468
3 changed files with 18 additions and 4 deletions
|
@ -73,6 +73,8 @@ applet_cmp(const void *a, const void *b)
|
||||||
|
|
||||||
void multicall_usage(int status) __attribute__((noreturn));
|
void multicall_usage(int status) __attribute__((noreturn));
|
||||||
|
|
||||||
|
struct if_applet ifupdown_applet;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -92,9 +94,11 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
self_applet = *app;
|
self_applet = *app;
|
||||||
process_options(*app, argc, argv);
|
|
||||||
|
|
||||||
return (*app)->main(argc, argv);
|
if (self_applet != &ifupdown_applet)
|
||||||
|
process_options(*app, argc, argv);
|
||||||
|
|
||||||
|
return self_applet->main(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -106,8 +110,6 @@ multicall_main(int argc, char *argv[])
|
||||||
return main(argc - 1, argv + 1);
|
return main(argc - 1, argv + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct if_applet ifupdown_applet;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
multicall_usage(int status)
|
multicall_usage(int status)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@ syntax(2)
|
||||||
|
|
||||||
test_suite('ifupdown-ng')
|
test_suite('ifupdown-ng')
|
||||||
|
|
||||||
|
atf_test_program{name='multicall_test'}
|
||||||
atf_test_program{name='ifquery_test'}
|
atf_test_program{name='ifquery_test'}
|
||||||
atf_test_program{name='ifup_test'}
|
atf_test_program{name='ifup_test'}
|
||||||
atf_test_program{name='ifdown_test'}
|
atf_test_program{name='ifdown_test'}
|
||||||
|
|
11
tests/multicall_test
Executable file
11
tests/multicall_test
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env atf-sh
|
||||||
|
|
||||||
|
. $(atf_get_srcdir)/test_env.sh
|
||||||
|
|
||||||
|
tests_init \
|
||||||
|
regress_getopt
|
||||||
|
|
||||||
|
regress_getopt_body() {
|
||||||
|
atf_check -e not-inline:'-F: applet not found' -o ignore -s exit:1 \
|
||||||
|
ifupdown ifquery -F
|
||||||
|
}
|
Loading…
Reference in a new issue