| 197 | } |
| 198 | |
| 199 | static bool launch(Fixture *f) { |
| 200 | if (restricted_requested) { |
| 201 | struct rlimit limited = f->saved, observed; |
| 202 | limited.rlim_cur = 0; |
| 203 | f->parent_restore_pending = true; |
| 204 | if (setrlimit(RLIMIT_NOFILE, &limited) != 0 || getrlimit(RLIMIT_NOFILE, &observed) != 0 || |
| 205 | !same_limit(&limited, &observed)) |
| 206 | return false; |
| 207 | } |
| 208 | f->pid = fork(); |
| 209 | if (f->pid == 0) |
| 210 | child_run(f); |
| 211 | /* Restore before closing handles, formatting paths, or inspecting the child. */ |
| 212 | bool restored = restore_parent(f); |
| 213 | return restored && f->pid > 0 && close_fd(&f->ack[1]) && close_fd(&f->gate[0]); |
| 214 | } |
| 215 | |
| 216 | static bool reap(Fixture *f, bool terminate) { |
| 217 | if (f->pid < 0 || f->reaped) |
no test coverage detected