| 323 | } |
| 324 | |
| 325 | static int ParseFd(dirent* dir_entry, int dir_fd) { |
| 326 | char* end; |
| 327 | const int fd = strtol(dir_entry->d_name, &end, 10); |
| 328 | if ((*end) != '\0') { |
| 329 | return -1; |
| 330 | } |
| 331 | // Don't bother with the standard input/output/error, they're handled |
| 332 | // specially post-fork anyway. |
| 333 | if (fd <= STDERR_FILENO || fd == dir_fd) { |
| 334 | return -1; |
| 335 | } |
| 336 | return fd; |
| 337 | } |