start_command(), .in/.out/.err = -1: Callers must close the file descriptor
[gitweb.git] / run-command.c
index 476d00c2182e3af82a0cfe495c61c9df1eb44d26..2919330366bbd52aca7fb860e4f82e7216652925 100644 (file)
@@ -25,7 +25,6 @@ int start_command(struct child_process *cmd)
                if (pipe(fdin) < 0)
                        return -ERR_RUN_COMMAND_PIPE;
                cmd->in = fdin[1];
-               cmd->close_in = 1;
        }
 
        need_out = !cmd->no_stdout
@@ -38,7 +37,6 @@ int start_command(struct child_process *cmd)
                        return -ERR_RUN_COMMAND_PIPE;
                }
                cmd->out = fdout[0];
-               cmd->close_out = 1;
        }
 
        need_err = !cmd->no_stderr && cmd->err < 0;
@@ -157,10 +155,6 @@ static int wait_or_whine(pid_t pid)
 
 int finish_command(struct child_process *cmd)
 {
-       if (cmd->close_in)
-               close(cmd->in);
-       if (cmd->close_out)
-               close(cmd->out);
        return wait_or_whine(cmd->pid);
 }