scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit f7ba49e4d1a750def40120fd78add0eda158d723
parent 60e2f95ebabb259c85515101a52aca843490fbc2
Author: Quentin Rameau <quinq@fifth.space>
Date:   Tue,  2 Feb 2016 17:37:11 +0100

Explicitly use stdout/stdin for pipe communication

Diffstat:
Mdriver/posix/scc.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 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)) {