commit ef40427c63d70059cae3a26daef388322389ccec
Author:     Quentin Rameau <[email protected]>
AuthorDate: Thu Jun 16 19:27:23 2016 +0200
Commit:     Quentin Rameau <[email protected]>
CommitDate: Fri Jun 17 21:41:11 2016 +0200

    [driver] set tool in and out fds in settool()
    
    We need that for first tool pass as those are initialized to 0.

diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index 1f569fc..f8bf4c7 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -206,8 +206,10 @@ settool(int tool, char *infile, int nexttool)
        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 @@ settool(int tool, char *infile, int nexttool)
                        die("scc: pipe: %s", strerror(errno));
                t->out = fds[1];
                fdin = fds[0];
+       } else {
+               t->out = -1;
        }
 
        addarg(tool, NULL);
@@ -289,8 +293,6 @@ validatetools(void)
                                free(t->args[i]);
                        t->nargs = t->nparams;
                        t->pid = 0;
-                       t->in = -1;
-                       t->out = -1;
                }
        }
 

Reply via email to