commit f7ba49e4d1a750def40120fd78add0eda158d723
Author:     Quentin Rameau <quinq@fifth.space>
AuthorDate: Tue Feb 2 17:37:11 2016 +0100
Commit:     Quentin Rameau <quinq@fifth.space>
CommitDate: Tue Feb 2 17:37:11 2016 +0100

    Explicitly use stdout/stdin for pipe communication

diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index 318293f..657c313 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -41,8 +41,7 @@ cc1(int fd)
                perror("scc:cc1");
                exit(1);
        case 0:
-               close(1);
-               dup(fd);
+               dup2(fd, 1);
                fmt = (arch) ? "%s/libexec/scc/cc1-%s" : "%s/libexec/scc/cc1";
                r = snprintf(cmd, sizeof(cmd), fmt, PREFIX, arch);
                if (r == sizeof(cmd)) {
@@ -71,8 +70,7 @@ cc2(int fd)
                perror("scc:cc2");
                exit(1);
        case 0:
-               close(0);
-               dup(fd);
+               dup2(fd, 0);
                fmt = (arch) ? "%s/libexec/scc/cc2-%s" : "%s/libexec/scc/cc2";
                r = snprintf(cmd, sizeof(cmd), fmt, PREFIX, arch);
                if (r == sizeof(cmd)) {

Reply via email to