diff options
author | Ron Yorston <rmy@pobox.com> | 2016-05-18 11:06:02 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2016-05-18 11:06:02 +0100 |
commit | c7c05c8e5723ed833ed0e73d24d7f7c45169c6e9 (patch) | |
tree | eba790e9f233e0649dba0887c064970cc3bb0b2d /win32 | |
parent | 4988f3c4cc3cb9e8b1ccb06e84768c177cb13385 (diff) | |
download | busybox-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.c | 14 |
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 | |||
332 | pid_t FAST_FUNC | 332 | pid_t FAST_FUNC |
333 | mingw_spawn(char **argv) | 333 | mingw_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 | |||
343 | intptr_t FAST_FUNC | ||
344 | mingw_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 | ||
338 | int | 350 | int |