diff options
Diffstat (limited to 'src/w32proc.c')
| -rw-r--r-- | src/w32proc.c | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/src/w32proc.c b/src/w32proc.c index 9b111b40e36..d888200c556 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -1220,13 +1220,22 @@ waitpid (pid_t pid, int *status, int options) | |||
| 1220 | { | 1220 | { |
| 1221 | QUIT; | 1221 | QUIT; |
| 1222 | active = WaitForMultipleObjects (nh, wait_hnd, FALSE, timeout_ms); | 1222 | active = WaitForMultipleObjects (nh, wait_hnd, FALSE, timeout_ms); |
| 1223 | } while (active == WAIT_TIMEOUT); | 1223 | } while (active == WAIT_TIMEOUT && !dont_wait); |
| 1224 | 1224 | ||
| 1225 | if (active == WAIT_FAILED) | 1225 | if (active == WAIT_FAILED) |
| 1226 | { | 1226 | { |
| 1227 | errno = EBADF; | 1227 | errno = EBADF; |
| 1228 | return -1; | 1228 | return -1; |
| 1229 | } | 1229 | } |
| 1230 | else if (active == WAIT_TIMEOUT && dont_wait) | ||
| 1231 | { | ||
| 1232 | /* PID specifies our subprocess, but it didn't exit yet, so its | ||
| 1233 | status is not yet available. */ | ||
| 1234 | #ifdef FULL_DEBUG | ||
| 1235 | DebPrint (("Wait: PID %d not reap yet\n", cp->pid)); | ||
| 1236 | #endif | ||
| 1237 | return 0; | ||
| 1238 | } | ||
| 1230 | else if (active >= WAIT_OBJECT_0 | 1239 | else if (active >= WAIT_OBJECT_0 |
| 1231 | && active < WAIT_OBJECT_0+MAXIMUM_WAIT_OBJECTS) | 1240 | && active < WAIT_OBJECT_0+MAXIMUM_WAIT_OBJECTS) |
| 1232 | { | 1241 | { |
| @@ -1274,33 +1283,7 @@ waitpid (pid_t pid, int *status, int options) | |||
| 1274 | #endif | 1283 | #endif |
| 1275 | 1284 | ||
| 1276 | if (status) | 1285 | if (status) |
| 1277 | { | 1286 | *status = retval; |
| 1278 | *status = retval; | ||
| 1279 | } | ||
| 1280 | else if (synch_process_alive) | ||
| 1281 | { | ||
| 1282 | synch_process_alive = 0; | ||
| 1283 | |||
| 1284 | /* Report the status of the synchronous process. */ | ||
| 1285 | if (WIFEXITED (retval)) | ||
| 1286 | synch_process_retcode = WEXITSTATUS (retval); | ||
| 1287 | else if (WIFSIGNALED (retval)) | ||
| 1288 | { | ||
| 1289 | int code = WTERMSIG (retval); | ||
| 1290 | const char *signame; | ||
| 1291 | |||
| 1292 | synchronize_system_messages_locale (); | ||
| 1293 | signame = strsignal (code); | ||
| 1294 | |||
| 1295 | if (signame == 0) | ||
| 1296 | signame = "unknown"; | ||
| 1297 | |||
| 1298 | synch_process_death = signame; | ||
| 1299 | } | ||
| 1300 | |||
| 1301 | reap_subprocess (cp); | ||
| 1302 | } | ||
| 1303 | |||
| 1304 | reap_subprocess (cp); | 1287 | reap_subprocess (cp); |
| 1305 | 1288 | ||
| 1306 | return pid; | 1289 | return pid; |
| @@ -2139,6 +2122,10 @@ sys_kill (int pid, int sig) | |||
| 2139 | int need_to_free = 0; | 2122 | int need_to_free = 0; |
| 2140 | int rc = 0; | 2123 | int rc = 0; |
| 2141 | 2124 | ||
| 2125 | /* Each process is in its own process group. */ | ||
| 2126 | if (pid < 0) | ||
| 2127 | pid = -pid; | ||
| 2128 | |||
| 2142 | /* Only handle signals that will result in the process dying */ | 2129 | /* Only handle signals that will result in the process dying */ |
| 2143 | if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) | 2130 | if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) |
| 2144 | { | 2131 | { |