ref: e1ca03524b266b4fd32a8de204c0076552aff7a5
parent: a420fdf054d2a3b4bdbc79e1fc9b200463e2554a
author: Quentin Rameau <quinq@fifth.space>
date: Wed Feb 15 11:38:20 EST 2017
[driver] Discard error messages not from cc1
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -7,6 +7,7 @@
#include <unistd.h>
#include <errno.h>
+#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
@@ -55,6 +56,7 @@
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 @@
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));
@@ -506,6 +510,9 @@
if (!(tmpdir = getenv("TMPDIR")) || !tmpdir[0])
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)));