diff options
Diffstat (limited to 'source/filter.c')
| -rw-r--r-- | source/filter.c | 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 9 insertions, 9 deletions
diff --git a/source/filter.c b/source/filter.c index 7f7942d..e15a5e9 100644 --- a/source/filter.c +++ b/source/filter.c @@ -46,19 +46,19 @@ static int open_exec_filter(struct cgit_filter *base, va_list ap) for (i = 0; i < filter->base.argument_count; i++) filter->argv[i + 1] = va_arg(ap, char *); - filter->old_stdout = chk_positive(dup(STDOUT_FILENO), + filter->old_stdout = cgit_die_unless_positive(dup(STDOUT_FILENO), "Unable to duplicate STDOUT"); - chk_zero(pipe(pipe_fh), "Unable to create pipe to subprocess"); - filter->pid = chk_non_negative(fork(), "Unable to create subprocess"); + cgit_die_unless_zero(pipe(pipe_fh), "Unable to create pipe to subprocess"); + filter->pid = cgit_die_unless_non_negative(fork(), "Unable to create subprocess"); if (filter->pid == 0) { close(pipe_fh[1]); - chk_non_negative(dup2(pipe_fh[0], STDIN_FILENO), + cgit_die_unless_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); } close(pipe_fh[0]); - chk_non_negative(dup2(pipe_fh[1], STDOUT_FILENO), + cgit_die_unless_non_negative(dup2(pipe_fh[1], STDOUT_FILENO), "Unable to use pipe as STDOUT"); close(pipe_fh[1]); return 0; @@ -69,7 +69,7 @@ static int close_exec_filter(struct cgit_filter *base) struct cgit_exec_filter *filter = (struct cgit_exec_filter *)base; int i, exit_status = 0; - chk_non_negative(dup2(filter->old_stdout, STDOUT_FILENO), + cgit_die_unless_non_negative(dup2(filter->old_stdout, STDOUT_FILENO), "Unable to restore STDOUT"); close(filter->old_stdout); if (filter->pid < 0) @@ -112,7 +112,7 @@ static struct cgit_filter *new_exec_filter(const char *cmd, int argument_count) f = xmalloc(sizeof(*f)); /* We leave argv for now and assign it below. */ - cgit_exec_filter_init(f, strdup_first_line(cmd), NULL); + cgit_exec_filter_init(f, cgit_strdup_first_line(cmd), NULL); f->base.argument_count = argument_count; args_size = (2 + argument_count) * sizeof(char *); f->argv = xmalloc(args_size); @@ -354,7 +354,7 @@ static struct cgit_filter *new_lua_filter(const char *cmd, int argument_count) filter->base.fprintfp = fprintf_lua_filter; filter->base.cleanup = cleanup_lua_filter; filter->base.argument_count = argument_count; - filter->script_file = strdup_first_line(cmd); + filter->script_file = cgit_strdup_first_line(cmd); return &filter->base; } @@ -401,7 +401,7 @@ static const struct { struct cgit_filter *cgit_new_filter(const char *cmd, filter_type filtertype) { const char *colon; - int i; + size_t i; size_t len; int argument_count; |
