scc

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

commit ef40427c63d70059cae3a26daef388322389ccec
parent 1d32900025c34caca5328141c8a81529b4bb882b
Author: Quentin Rameau <quinq@fifth.space>
Date:   Thu, 16 Jun 2016 19:27:23 +0200

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

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

Diffstat:
Mdriver/posix/scc.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 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; } }