diff options
author | Ron Yorston <rmy@pobox.com> | 2015-05-27 15:05:11 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-05-27 15:05:11 +0100 |
commit | 0711c1f4eda3f10d8295ca0d9eb50e1a380baa86 (patch) | |
tree | 5c78ccf33973103b0650e05d7a5cc76a62a9e861 | |
parent | 4a9a7addbc23be8e7db385697678f53a9d0b96a1 (diff) | |
download | busybox-w32-0711c1f4eda3f10d8295ca0d9eb50e1a380baa86.tar.gz busybox-w32-0711c1f4eda3f10d8295ca0d9eb50e1a380baa86.tar.bz2 busybox-w32-0711c1f4eda3f10d8295ca0d9eb50e1a380baa86.zip |
win32: fix waitpid implementation
_cwait requires a process handle, not a pid.
-rw-r--r-- | win32/process.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/win32/process.c b/win32/process.c index 462731a2d..dc9e98305 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -3,9 +3,18 @@ | |||
3 | 3 | ||
4 | int waitpid(pid_t pid, int *status, unsigned options) | 4 | int waitpid(pid_t pid, int *status, unsigned options) |
5 | { | 5 | { |
6 | HANDLE proc; | ||
7 | int ret; | ||
8 | |||
6 | /* Windows does not understand parent-child */ | 9 | /* Windows does not understand parent-child */ |
7 | if (options == 0 && pid != -1) | 10 | if (options == 0 && pid != -1) { |
8 | return _cwait(status, pid, 0); | 11 | if ( (proc=OpenProcess(SYNCHRONIZE|PROCESS_QUERY_INFORMATION, |
12 | FALSE, pid)) != NULL ) { | ||
13 | ret = _cwait(status, proc, 0); | ||
14 | CloseHandle(proc); | ||
15 | return ret; | ||
16 | } | ||
17 | } | ||
9 | errno = EINVAL; | 18 | errno = EINVAL; |
10 | return -1; | 19 | return -1; |
11 | } | 20 | } |