| 182 | } |
| 183 | |
| 184 | static bool setup(Fixture *f, const char *root) { |
| 185 | int n = snprintf(f->control, sizeof(f->control), "%s/parent-control.XXXXXX", root); |
| 186 | if (n <= 0 || (size_t)n >= sizeof(f->control)) |
| 187 | return false; |
| 188 | int fd = mkstemp(f->control); |
| 189 | if (fd < 0) |
| 190 | return false; |
| 191 | struct stat info; |
| 192 | bool ok = fstat(fd, &info) == 0 && S_ISREG(info.st_mode); |
| 193 | if (close(fd) != 0) |
| 194 | ok = false; |
| 195 | return ok && pipe(f->ack) == 0 && pipe(f->gate) == 0 && |
| 196 | getrlimit(RLIMIT_NOFILE, &f->saved) == 0 && fflush(NULL) == 0; |
| 197 | } |
| 198 | |
| 199 | static bool launch(Fixture *f) { |
| 200 | if (restricted_requested) { |