shithub: scc

Download patch

ref: f5b786d721fb88f375f21b40678c046d3732e8ca
parent: f1d2a5c200bbde707b6a7b39efd353fec1ac5fb3
author: Quentin Rameau <quinq@fifth.space>
date: Thu Jun 16 15:27:23 EDT 2016

[driver] set tool in and out fds in settool()

We need that for first tool pass as those are initialized to 0.

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -206,8 +206,10 @@
 	if (fdin > -1) {
 		t->in = fdin;
 		fdin = -1;
-	} else if (infile) {
-		addarg(tool, xstrdup(infile));
+	} else {
+		t->in = -1;
+		if (infile)
+			addarg(tool, xstrdup(infile));
 	}
 
 	if (nexttool < LAST_TOOL) {
@@ -215,6 +217,8 @@
 			die("scc: pipe: %s", strerror(errno));
 		t->out = fds[1];
 		fdin = fds[0];
+	} else {
+		t->out = -1;
 	}
 
 	addarg(tool, NULL);
@@ -289,8 +293,6 @@
 				free(t->args[i]);
 			t->nargs = t->nparams;
 			t->pid = 0;
-			t->in = -1;
-			t->out = -1;
 		}
 	}