shithub: scc

Download patch

ref: 8b178526d17c09010b94b2c6655c0c98648a2f68
parent: 52c91656da390b9135444e74d7bc2bd94e9da285
author: Quentin Rameau <[email protected]>
date: Mon Aug 28 19:36:56 EDT 2017

[driver] Fix devnullfd initialisation

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

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -60,7 +60,7 @@
 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 @@
 	    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);
 	}