[hackers] [scc] [driver] set tool in and out fds in settool() || Quentin Rameau

From: <git_AT_suckless.org>
Date: Fri, 17 Jun 2016 21:45:14 +0200 (CEST)

commit ef40427c63d70059cae3a26daef388322389ccec
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Thu Jun 16 19:27:23 2016 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
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
_AT_@ -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) {
_AT_@ -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);
_AT_@ -289,8 +293,6 @@ validatetools(void)
                                 free(t->args[i]);
                         t->nargs = t->nparams;
                         t->pid = 0;
- t->in = -1;
- t->out = -1;
                 }
         }
 
Received on Fri Jun 17 2016 - 21:45:14 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 17 2016 - 21:48:46 CEST