summaryrefslogtreecommitdiff
path: root/util-linux/flock.c
diff options
context:
space:
mode:
authorDenys Vlasenko2016-04-24 18:21:32 +0200
committerDenys Vlasenko2016-04-24 18:21:32 +0200
commit2fbc3123a2d94a85317b2269c724939db7e18fbf (patch)
treef0d0d7e120145ed46f06933429f6f932fca7c643 /util-linux/flock.c
parente1d426fd65c00a6d01a10d85edf8a294ae8a2d2b (diff)
downloadbusybox-2fbc3123a2d94a85317b2269c724939db7e18fbf.zip
busybox-2fbc3123a2d94a85317b2269c724939db7e18fbf.tar.gz
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>
Diffstat (limited to 'util-linux/flock.c')
-rw-r--r--util-linux/flock.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/util-linux/flock.c b/util-linux/flock.c
index 539a835..1f7ade7 100644
--- a/util-linux/flock.c
+++ b/util-linux/flock.c
@@ -93,19 +93,19 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
}
if (argv[0]) {
- if (!(opt & OPT_c)) {
- int rc = spawn_and_wait(argv);
- if (rc < 0)
- bb_simple_perror_msg(argv[0]);
- return rc;
+ int rc;
+ if (opt & OPT_c) {
+ /* -c 'PROG ARGS' means "run sh -c 'PROG ARGS'" */
+ argv -= 2;
+ 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'" */
- argv -= 2;
- argv[0] = (char*)get_shell_name();
- argv[1] = (char*)"-c";
- /* argv[2] = "PROG ARGS"; */
- /* argv[3] = NULL; */
- return spawn_and_wait(argv);
+ rc = spawn_and_wait(argv);
+ if (rc < 0)
+ bb_simple_perror_msg(argv[0]);
+ return rc;
}
return EXIT_SUCCESS;