| 480 | } |
| 481 | |
| 482 | void set_env_num(const char *var, long num) |
| 483 | { |
| 484 | #ifdef HAVE_SETENV |
| 485 | char val[64]; |
| 486 | (void)snprintf(val, sizeof val, "%ld", num); |
| 487 | if (setenv(var, val, 1) < 0) |
| 488 | out_of_memory("set_env_str"); |
| 489 | #else |
| 490 | #ifdef HAVE_PUTENV |
| 491 | char *mem; |
| 492 | if (asprintf(&mem, "%s=%ld", var, num) < 0) |
| 493 | out_of_memory("set_env_num"); |
| 494 | putenv(mem); |
| 495 | #endif |
| 496 | #endif |
| 497 | } |
| 498 | |
| 499 | /* Used for "early exec", "pre-xfer exec", and the "name converter" script. */ |
| 500 | static pid_t start_pre_exec(const char *cmd, int *arg_fd_ptr, int *error_fd_ptr) |
no test coverage detected