| 335 | } |
| 336 | |
| 337 | static bool gf_capture_create(cbm_git_facts_t *facts, gf_capture_t *capture, |
| 338 | cbm_git_facts_error_t *error) { |
| 339 | memset(capture, 0, sizeof(*capture)); |
| 340 | if (!gf_private_directory(facts, capture->directory, error)) |
| 341 | return false; |
| 342 | int a = snprintf(capture->out, sizeof(capture->out), "%s/stdout", capture->directory); |
| 343 | int b = snprintf(capture->err, sizeof(capture->err), "%s/stderr", capture->directory); |
| 344 | if (a < 0 || b < 0 || (size_t)a >= sizeof(capture->out) || (size_t)b >= sizeof(capture->err)) { |
| 345 | capture->out[0] = capture->err[0] = '\0'; |
| 346 | (void)gf_capture_cleanup(capture); |
| 347 | return gf_error(error, CBM_GIT_FACTS_IO, "Capture path exceeds supported length"); |
| 348 | } |
| 349 | return true; |
| 350 | } |
| 351 | |
| 352 | /* The private writer is closed before spawn. Only canonical OID lines reach |
| 353 | * this transport; the child opens its independent read-only binary handle. */ |
no test coverage detected