{
int fd_stderr = open(path_stderr, O_RDONLY | O_BINARY);
if (fd_stderr != -1) {
- copy_fd(fd_stderr, 2);
+ copy_fd(fd_stderr, STDERR_FILENO);
close(fd_stderr);
}
}
int fd = open(tmp_stderr.c_str(), O_RDONLY | O_BINARY);
if (fd != -1) {
// We can output stderr immediately instead of rerunning the compiler.
- copy_fd(fd, 2);
+ copy_fd(fd, STDERR_FILENO);
close(fd);
}
static void
set_up_uncached_err()
{
- int uncached_fd = dup(2); // The file descriptor is intentionally leaked.
+ int uncached_fd =
+ dup(STDERR_FILENO); // The file descriptor is intentionally leaked.
if (uncached_fd == -1) {
cc_log("dup(2) failed: %s", strerror(errno));
failed(STATS_ERROR);
if (*pid == 0) {
// Child.
- dup2(fd_out, 1);
+ dup2(fd_out, STDOUT_FILENO);
close(fd_out);
- dup2(fd_err, 2);
+ dup2(fd_err, STDERR_FILENO);
close(fd_err);
x_exit(execv(argv[0], const_cast<char* const*>(argv)));
}