{
memset(child, 0, sizeof(*child));
argv_array_init(&child->args);
+ argv_array_init(&child->env_array);
}
struct child_to_clean {
if (!cmd->argv)
cmd->argv = cmd->args.argv;
+ if (!cmd->env)
+ cmd->env = cmd->env_array.argv;
/*
* In case of errors we must keep the promise to close FDs
error("cannot create %s pipe for %s: %s",
str, cmd->argv[0], strerror(failed_errno));
argv_array_clear(&cmd->args);
+ argv_array_clear(&cmd->env_array);
errno = failed_errno;
return -1;
}
else if (cmd->err)
close(cmd->err);
argv_array_clear(&cmd->args);
+ argv_array_clear(&cmd->env_array);
errno = failed_errno;
return -1;
}
{
int ret = wait_or_whine(cmd->pid, cmd->argv[0]);
argv_array_clear(&cmd->args);
+ argv_array_clear(&cmd->env_array);
return ret;
}
static int git_atexit_installed;
-static void git_atexit_dispatch()
+static void git_atexit_dispatch(void)
{
size_t i;
git_atexit_hdlrs.handlers[i-1]();
}
-static void git_atexit_clear()
+static void git_atexit_clear(void)
{
free(git_atexit_hdlrs.handlers);
memset(&git_atexit_hdlrs, 0, sizeof(git_atexit_hdlrs));