| 967 | } |
| 968 | |
| 969 | static void bootstrap_enospc_reap(bootstrap_enospc_host_t *state, int *nonzero_exits) { |
| 970 | *nonzero_exits = 0; |
| 971 | for (size_t i = 0; i < state->child_count; i++) { |
| 972 | int status = state->exit_status[i]; |
| 973 | if (!state->reaped[i]) { |
| 974 | /* Only reachable when the synchronous wait in the spawn itself |
| 975 | * failed; never leave a host behind. */ |
| 976 | pid_t waited; |
| 977 | (void)kill(state->children[i], SIGKILL); |
| 978 | do { |
| 979 | waited = waitpid(state->children[i], &status, 0); |
| 980 | } while (waited < 0 && errno == EINTR); |
| 981 | } |
| 982 | if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { |
| 983 | (*nonzero_exits)++; |
| 984 | } |
| 985 | } |
| 986 | } |
| 987 | |
| 988 | static bool bootstrap_read_file(const char *path, char *out, size_t capacity) { |
| 989 | FILE *file = cbm_fopen(path, "rb"); |
no outgoing calls
no test coverage detected