diff options
author | Ron Yorston <rmy@pobox.com> | 2017-09-26 16:40:37 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2017-09-26 16:40:37 +0100 |
commit | caf2a1b67ffeac7dd102424ae904818b478e65c6 (patch) | |
tree | 8a9921da1d1517476a5af8220dcfa24942e275b8 | |
parent | 3cfc5cc69d02f6832da1060c814ad564a357f006 (diff) | |
download | busybox-w32-dscho-kill-gently.tar.gz busybox-w32-dscho-kill-gently.tar.bz2 busybox-w32-dscho-kill-gently.zip |
timeout: use new kill(2) to signal childdscho-kill-gently
-rw-r--r-- | coreutils/timeout.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/coreutils/timeout.c b/coreutils/timeout.c index 68188b389..6db3e1bc8 100644 --- a/coreutils/timeout.c +++ b/coreutils/timeout.c | |||
@@ -52,15 +52,13 @@ int timeout_main(int argc UNUSED_PARAM, char **argv) | |||
52 | int signo; | 52 | int signo; |
53 | #if !ENABLE_PLATFORM_MINGW32 | 53 | #if !ENABLE_PLATFORM_MINGW32 |
54 | int status; | 54 | int status; |
55 | #endif | ||
56 | int parent = 0; | ||
57 | int timeout = 10; | ||
58 | #if !ENABLE_PLATFORM_MINGW32 | ||
59 | pid_t pid; | ||
60 | #else | 55 | #else |
61 | intptr_t ret; | 56 | intptr_t ret; |
62 | HANDLE h; | 57 | HANDLE h; |
63 | #endif | 58 | #endif |
59 | int parent = 0; | ||
60 | int timeout = 10; | ||
61 | pid_t pid; | ||
64 | #if !BB_MMU | 62 | #if !BB_MMU |
65 | char *sv1, *sv2; | 63 | char *sv1, *sv2; |
66 | #endif | 64 | #endif |
@@ -133,7 +131,7 @@ int timeout_main(int argc UNUSED_PARAM, char **argv) | |||
133 | #endif | 131 | #endif |
134 | BB_EXECVP_or_die(argv); | 132 | BB_EXECVP_or_die(argv); |
135 | #else /* ENABLE_PLATFORM_MINGW32 */ | 133 | #else /* ENABLE_PLATFORM_MINGW32 */ |
136 | if (signo != SIGTERM) | 134 | if (signo != SIGTERM && signo != SIGKILL && signo != 0) |
137 | bb_error_msg_and_die("unknown signal '%s'", opt_s); | 135 | bb_error_msg_and_die("unknown signal '%s'", opt_s); |
138 | 136 | ||
139 | argv += optind; | 137 | argv += optind; |
@@ -154,7 +152,8 @@ int timeout_main(int argc UNUSED_PARAM, char **argv) | |||
154 | } | 152 | } |
155 | } | 153 | } |
156 | 154 | ||
157 | TerminateProcess(h, 0); | 155 | pid = (pid_t)GetProcessId(h); |
156 | kill(pid, signo); | ||
158 | finish: | 157 | finish: |
159 | CloseHandle(h); | 158 | CloseHandle(h); |
160 | return EXIT_SUCCESS; | 159 | return EXIT_SUCCESS; |