summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9d751e7)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
char *cmd;
char **argv;
int old_stdout;
char *cmd;
char **argv;
int old_stdout;
static int open_exec_filter(struct cgit_filter *base, va_list ap)
{
struct cgit_exec_filter *filter = (struct cgit_exec_filter *)base;
static int open_exec_filter(struct cgit_filter *base, va_list ap)
{
struct cgit_exec_filter *filter = (struct cgit_exec_filter *)base;
int i;
for (i = 0; i < filter->base.argument_count; i++)
int i;
for (i = 0; i < filter->base.argument_count; i++)
filter->old_stdout = chk_positive(dup(STDOUT_FILENO),
"Unable to duplicate STDOUT");
filter->old_stdout = chk_positive(dup(STDOUT_FILENO),
"Unable to duplicate STDOUT");
- chk_zero(pipe(filter->pipe_fh), "Unable to create pipe to subprocess");
+ chk_zero(pipe(pipe_fh), "Unable to create pipe to subprocess");
filter->pid = chk_non_negative(fork(), "Unable to create subprocess");
if (filter->pid == 0) {
filter->pid = chk_non_negative(fork(), "Unable to create subprocess");
if (filter->pid == 0) {
- close(filter->pipe_fh[1]);
- chk_non_negative(dup2(filter->pipe_fh[0], STDIN_FILENO),
+ close(pipe_fh[1]);
+ chk_non_negative(dup2(pipe_fh[0], STDIN_FILENO),
"Unable to use pipe as STDIN");
execvp(filter->cmd, filter->argv);
die_errno("Unable to exec subprocess %s", filter->cmd);
}
"Unable to use pipe as STDIN");
execvp(filter->cmd, filter->argv);
die_errno("Unable to exec subprocess %s", filter->cmd);
}
- close(filter->pipe_fh[0]);
- chk_non_negative(dup2(filter->pipe_fh[1], STDOUT_FILENO),
+ close(pipe_fh[0]);
+ chk_non_negative(dup2(pipe_fh[1], STDOUT_FILENO),
"Unable to use pipe as STDOUT");
"Unable to use pipe as STDOUT");
- close(filter->pipe_fh[1]);