diff options
author | Ron Yorston <rmy@pobox.com> | 2015-05-29 14:25:17 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-05-29 14:25:17 +0100 |
commit | 85ce92a584b8ca1a5c33828faf66ad304689e71f (patch) | |
tree | a36b290cf356830fcea455c08fa98a64afd98d5d /win32/process.c | |
parent | 6fb17897d620572290b1f604430c06c261145aad (diff) | |
download | busybox-w32-85ce92a584b8ca1a5c33828faf66ad304689e71f.tar.gz busybox-w32-85ce92a584b8ca1a5c33828faf66ad304689e71f.tar.bz2 busybox-w32-85ce92a584b8ca1a5c33828faf66ad304689e71f.zip |
mingw: tidy up implementation of kill(2)
Diffstat (limited to 'win32/process.c')
-rw-r--r-- | win32/process.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/win32/process.c b/win32/process.c index e9db5311e..318515375 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -376,15 +376,19 @@ int kill(pid_t pid, int sig) | |||
376 | { | 376 | { |
377 | HANDLE h; | 377 | HANDLE h; |
378 | 378 | ||
379 | if (sig != SIGTERM) { | 379 | if (pid > 0 && sig == SIGTERM) { |
380 | bb_error_msg("kill only supports SIGTERM"); | 380 | if ((h=OpenProcess(PROCESS_TERMINATE, FALSE, pid)) != NULL && |
381 | errno = EINVAL; | 381 | TerminateProcess(h, 0)) { |
382 | CloseHandle(h); | ||
383 | return 0; | ||
384 | } | ||
385 | |||
386 | errno = err_win_to_posix(GetLastError()); | ||
387 | if (h != NULL) | ||
388 | CloseHandle(h); | ||
382 | return -1; | 389 | return -1; |
383 | } | 390 | } |
384 | h = OpenProcess(PROCESS_TERMINATE, FALSE, pid); | 391 | |
385 | if (h == NULL) | 392 | errno = EINVAL; |
386 | return -1; | 393 | return -1; |
387 | if (TerminateProcess(h, 0) == 0) | ||
388 | return -1; | ||
389 | return 0; | ||
390 | } | 394 | } |