| ... | @@ -341,8 +341,11 @@ extern fn sigchld_handler(_: i32) { | ... | @@ -341,8 +341,11 @@ extern fn sigchld_handler(_: i32) { |
| 341 | var status: i32 = undefined; | 341 | var status: i32 = undefined; |
| 342 | const pid_result = posix.waitpid(-1, &status, posix.WNOHANG); | 342 | const pid_result = posix.waitpid(-1, &status, posix.WNOHANG); |
| 343 | const err = posix.getErrno(pid_result); | 343 | const err = posix.getErrno(pid_result); |
| 344 | if (err == posix.ECHILD) { | 344 | if (err > 0) { |
| 345 | return; | 345 | if (err == posix.ECHILD) { |
| | 346 | return; |
| | 347 | } |
| | 348 | unreachable; |
| 346 | } | 349 | } |
| 347 | handleTerm(i32(pid_result), status); | 350 | handleTerm(i32(pid_result), status); |
| 348 | } | 351 | } |
| ... | @@ -352,12 +355,10 @@ fn handleTerm(pid: i32, status: i32) { | ... | @@ -352,12 +355,10 @@ fn handleTerm(pid: i32, status: i32) { |
| 352 | var it = children_nodes.first; | 355 | var it = children_nodes.first; |
| 353 | while (it) |node| : (it = node.next) { | 356 | while (it) |node| : (it = node.next) { |
| 354 | if (node.data.pid == pid) { | 357 | if (node.data.pid == pid) { |
| 355 | assert(node.data.term == null); | | |
| 356 | node.data.handleWaitResult(status); | 358 | node.data.handleWaitResult(status); |
| 357 | return; | 359 | return; |
| 358 | } | 360 | } |
| 359 | } | 361 | } |
| 360 | unreachable; | | |
| 361 | } | 362 | } |
| 362 | | 363 | |
| 363 | const sigchld_set = { | 364 | const sigchld_set = { |