commit b4bedf30b77624450f8c1e9d3aafd7ab0e41075c
parent 4ddd2d61847e132b3ced1e658d47e91529ab646f
Author: Quentin Rameau <quinq@fifth.space>
Date: Wed, 15 Feb 2017 16:38:20 +0100
[driver] Discard error messages not from cc1
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/driver/posix/scc.c b/driver/posix/scc.c
@@ -7,6 +7,7 @@ static char sccsid[] = "@(#) ./driver/posix/scc.c";
#include <unistd.h>
#include <errno.h>
+#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
@@ -55,6 +56,7 @@ static char *tmpdir;
static size_t tmpdirln;
static struct items objtmp, objout;
static int Mflag, Eflag, Sflag, cflag, kflag, sflag;
+static int devnullfd;
extern int failure;
@@ -246,6 +248,8 @@ spawn(int tool)
dup2(t->out, 1);
if (t->in > -1)
dup2(t->in, 0);
+ if (tool != CC1)
+ dup2(devnullfd, 2);
execvp(t->cmd, t->args.s);
fprintf(stderr, "scc: execvp %s: %s\n",
t->cmd, strerror(errno));
@@ -507,6 +511,9 @@ operand:
tmpdir = ".";
tmpdirln = strlen(tmpdir);
+ if ((devnullfd = open("/dev/null", O_WRONLY)) < 0)
+ fputs("scc: could not open /dev/null\n", stderr);
+
build(&linkchain, (link = !(Mflag || Eflag || Sflag || cflag)));
if (!(link || cflag))