aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2016-05-18 11:06:02 +0100
committerRon Yorston <rmy@pobox.com>2016-05-18 11:06:02 +0100
commitc7c05c8e5723ed833ed0e73d24d7f7c45169c6e9 (patch)
treeeba790e9f233e0649dba0887c064970cc3bb0b2d /win32
parent4988f3c4cc3cb9e8b1ccb06e84768c177cb13385 (diff)
downloadbusybox-w32-c7c05c8e5723ed833ed0e73d24d7f7c45169c6e9.tar.gz
busybox-w32-c7c05c8e5723ed833ed0e73d24d7f7c45169c6e9.tar.bz2
busybox-w32-c7c05c8e5723ed833ed0e73d24d7f7c45169c6e9.zip
ash: fix use of pid/handle in waitpid_child
Previously spawn was returning a process handle which was treated as a pid in certain circumstances. This resulted in the following failing: find . -type f | sed xargs -n 1 sed -n '1 p' It should output the first line of each file but stopped after the first.
Diffstat (limited to 'win32')
-rw-r--r--win32/process.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/win32/process.c b/win32/process.c
index 8cd1dc28c..9a4b05597 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -332,7 +332,19 @@ mingw_spawn_1(int mode, const char *cmd, const char *const *argv, const char *co
332pid_t FAST_FUNC 332pid_t FAST_FUNC
333mingw_spawn(char **argv) 333mingw_spawn(char **argv)
334{ 334{
335 return mingw_spawn_1(P_NOWAIT, argv[0], (const char *const *)argv, (const char *const *)environ); 335 intptr_t ret;
336
337 ret = mingw_spawn_1(P_NOWAIT, argv[0], (const char *const *)argv,
338 (const char *const *)environ);
339
340 return ret == -1 ? -1 : GetProcessId((HANDLE)ret);
341}
342
343intptr_t FAST_FUNC
344mingw_spawn_proc(char **argv)
345{
346 return mingw_spawn_1(P_NOWAIT, argv[0], (const char *const *)argv,
347 (const char *const *)environ);
336} 348}
337 349
338int 350int