| 456 | } |
| 457 | |
| 458 | static void pipe_fixed_length(const char *prog_name, int out, size_t req_len) |
| 459 | { |
| 460 | unsigned char buf[8192]; |
| 461 | size_t remaining_len = req_len; |
| 462 | |
| 463 | while (remaining_len > 0) { |
| 464 | size_t chunk_length = remaining_len > sizeof(buf) ? sizeof(buf) : remaining_len; |
| 465 | ssize_t n = xread(0, buf, chunk_length); |
| 466 | if (n < 0) |
| 467 | die_errno("Reading request failed"); |
| 468 | write_to_child(out, buf, n, prog_name); |
| 469 | remaining_len -= n; |
| 470 | } |
| 471 | |
| 472 | close(out); |
| 473 | } |
| 474 | |
| 475 | static void run_service(const char **argv, int buffer_input) |
| 476 | { |
no test coverage detected