| 272 | } |
| 273 | |
| 274 | static bool finish_child(Child *child, int *status, bool *reaped) { |
| 275 | if (child->operation == SETUP_KILL) { |
| 276 | if (!reap(child, true, status, reaped)) |
| 277 | return false; |
| 278 | } else { |
| 279 | if (!send_byte(child->gate[1], 'G') || !held_protocol(child) || |
| 280 | !reap(child, false, status, reaped)) |
| 281 | return false; |
| 282 | } |
| 283 | bool expected = child->operation == SETUP_KILL |
| 284 | ? WIFSIGNALED(*status) && WTERMSIG(*status) == SIGKILL |
| 285 | : WIFEXITED(*status) && WEXITSTATUS(*status) == 0; |
| 286 | if (!expected || (child->obstruct && !remove_obstruction(child))) |
| 287 | return false; |
| 288 | int final = marker_present(child); |
| 289 | return final >= 0 && |
| 290 | note(child, "reaped", final, |
| 291 | WIFSIGNALED(*status) ? 128 + WTERMSIG(*status) : WEXITSTATUS(*status)); |
| 292 | } |
| 293 | |
| 294 | static int run_child(const char *stem, const char *id, enum ChildOperation operation, |
| 295 | bool obstruct) { |
no test coverage detected