scc

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

commit f931d1f2a0a90f71ff7b6895c7dba29fbe9f10d9
parent e1001b8ff07111263c19b7ecef718fd80d010e64
Author: Quentin Rameau <quinq@fifth.space>
Date:   Mon, 28 Aug 2017 23:36:56 +0200

[driver] Fix devnullfd initialisation

Fix the dflag check,
initialize the fd to -1 to be safe

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

diff --git a/driver/posix/scc.c b/driver/posix/scc.c @@ -60,7 +60,7 @@ static char *tmpdir; static size_t tmpdirln; static struct items objtmp, objout; static int Mflag, Eflag, Sflag, cflag, dflag, kflag, sflag, Qflag = USEQBE; -static int devnullfd; +static int devnullfd = -1; extern int failure; @@ -563,7 +563,7 @@ operand: linkchain.n > 1 && cflag && outfile) usage(); - if (dflag) { + if (!dflag) { if ((devnullfd = open("/dev/null", O_WRONLY)) < 0) fputs("scc: could not open /dev/null\n", stderr); }