diff options
-rw-r--r-- | coreutils/timeout.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/coreutils/timeout.c b/coreutils/timeout.c index c8171ec54..3565c005d 100644 --- a/coreutils/timeout.c +++ b/coreutils/timeout.c | |||
@@ -97,11 +97,11 @@ int timeout_main(int argc UNUSED_PARAM, char **argv) | |||
97 | int signo; | 97 | int signo; |
98 | #if !ENABLE_PLATFORM_MINGW32 | 98 | #if !ENABLE_PLATFORM_MINGW32 |
99 | int status; | 99 | int status; |
100 | int parent = 0; | ||
100 | #else | 101 | #else |
101 | intptr_t ret; | 102 | intptr_t ret; |
102 | DWORD status = EXIT_SUCCESS; | 103 | DWORD status = EXIT_SUCCESS; |
103 | #endif | 104 | #endif |
104 | int parent = 0; | ||
105 | int timeout; | 105 | int timeout; |
106 | int kill_timeout; | 106 | int kill_timeout; |
107 | pid_t pid; | 107 | pid_t pid; |
@@ -119,7 +119,11 @@ int timeout_main(int argc UNUSED_PARAM, char **argv) | |||
119 | 119 | ||
120 | /* -t SECONDS; -p PARENT_PID */ | 120 | /* -t SECONDS; -p PARENT_PID */ |
121 | /* '+': stop at first non-option */ | 121 | /* '+': stop at first non-option */ |
122 | #if !ENABLE_PLATFORM_MINGW32 | ||
122 | getopt32(argv, "+s:k:" USE_FOR_NOMMU("p:+"), &opt_s, &opt_k, &parent); | 123 | getopt32(argv, "+s:k:" USE_FOR_NOMMU("p:+"), &opt_s, &opt_k, &parent); |
124 | #else | ||
125 | getopt32(argv, "+s:k:", &opt_s, &opt_k); | ||
126 | #endif | ||
123 | /*argv += optind; - no, wait for bb_daemonize_or_rexec! */ | 127 | /*argv += optind; - no, wait for bb_daemonize_or_rexec! */ |
124 | 128 | ||
125 | signo = get_signum(opt_s); | 129 | signo = get_signum(opt_s); |
@@ -212,7 +216,7 @@ int timeout_main(int argc UNUSED_PARAM, char **argv) | |||
212 | if (kill_timeout > 0) { | 216 | if (kill_timeout > 0) { |
213 | if (timeout_wait(kill_timeout, child, &status)) | 217 | if (timeout_wait(kill_timeout, child, &status)) |
214 | goto finish; | 218 | goto finish; |
215 | kill(parent, SIGKILL); | 219 | kill(pid, SIGKILL); |
216 | status = 137; | 220 | status = 137; |
217 | } | 221 | } |
218 | finish: | 222 | finish: |