flock: merge spawn_and_wait() code patchs for -c and sans-c uses
function old new delta flock_main 334 319 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
e1d426fd65
commit
2fbc3123a2
@ -93,19 +93,19 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argv[0]) {
|
if (argv[0]) {
|
||||||
if (!(opt & OPT_c)) {
|
int rc;
|
||||||
int rc = spawn_and_wait(argv);
|
if (opt & OPT_c) {
|
||||||
if (rc < 0)
|
/* -c 'PROG ARGS' means "run sh -c 'PROG ARGS'" */
|
||||||
bb_simple_perror_msg(argv[0]);
|
argv -= 2;
|
||||||
return rc;
|
argv[0] = (char*)get_shell_name();
|
||||||
|
argv[1] = (char*)"-c";
|
||||||
|
/* argv[2] = "PROG ARGS"; */
|
||||||
|
/* argv[3] = NULL; */
|
||||||
}
|
}
|
||||||
/* -c 'PROG ARGS' means "run sh -c 'PROG ARGS'" */
|
rc = spawn_and_wait(argv);
|
||||||
argv -= 2;
|
if (rc < 0)
|
||||||
argv[0] = (char*)get_shell_name();
|
bb_simple_perror_msg(argv[0]);
|
||||||
argv[1] = (char*)"-c";
|
return rc;
|
||||||
/* argv[2] = "PROG ARGS"; */
|
|
||||||
/* argv[3] = NULL; */
|
|
||||||
return spawn_and_wait(argv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
Loading…
Reference in New Issue
Block a user