aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-04-24 18:21:32 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-04-24 18:21:32 +0200
commit2fbc3123a2d94a85317b2269c724939db7e18fbf (patch)
treef0d0d7e120145ed46f06933429f6f932fca7c643
parente1d426fd65c00a6d01a10d85edf8a294ae8a2d2b (diff)
downloadbusybox-w32-2fbc3123a2d94a85317b2269c724939db7e18fbf.tar.gz
busybox-w32-2fbc3123a2d94a85317b2269c724939db7e18fbf.tar.bz2
busybox-w32-2fbc3123a2d94a85317b2269c724939db7e18fbf.zip
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>
-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 539a835b7..1f7ade7c4 100644
--- a/util-linux/flock.c
+++ b/util-linux/flock.c
@@ -93,19 +93,19 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
93 } 93 }
94 94
95 if (argv[0]) { 95 if (argv[0]) {
96 if (!(opt & OPT_c)) { 96 int rc;
97 int rc = spawn_and_wait(argv); 97 if (opt & OPT_c) {
98 if (rc < 0) 98 /* -c 'PROG ARGS' means "run sh -c 'PROG ARGS'" */
99 bb_simple_perror_msg(argv[0]); 99 argv -= 2;
100 return rc; 100 argv[0] = (char*)get_shell_name();
101 argv[1] = (char*)"-c";
102 /* argv[2] = "PROG ARGS"; */
103 /* argv[3] = NULL; */
101 } 104 }
102 /* -c 'PROG ARGS' means "run sh -c 'PROG ARGS'" */ 105 rc = spawn_and_wait(argv);
103 argv -= 2; 106 if (rc < 0)
104 argv[0] = (char*)get_shell_name(); 107 bb_simple_perror_msg(argv[0]);
105 argv[1] = (char*)"-c"; 108 return rc;
106 /* argv[2] = "PROG ARGS"; */
107 /* argv[3] = NULL; */
108 return spawn_and_wait(argv);
109 } 109 }
110 110
111 return EXIT_SUCCESS; 111 return EXIT_SUCCESS;