Signed-off-by: Alex Riesen <raa.lkml@xxxxxxxxx> --- run-command.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/run-command.c b/run-command.c index 605aa1e..3a5f737 100644 --- a/run-command.c +++ b/run-command.c @@ -77,8 +77,18 @@ int start_command(struct child_process *cmd) die("exec %s: cd to %s failed (%s)", cmd->argv[0], cmd->dir, strerror(errno)); if (cmd->env) { - for (; *cmd->env; cmd->env++) - putenv((char*)*cmd->env); + char *unsetbuf = NULL; + for (; *cmd->env; cmd->env++) { + size_t n = strlen(*cmd->env); + if (n && (*cmd->env)[n-1] == '=') { + unsetbuf = xrealloc(unsetbuf, n); + memcpy(unsetbuf, *cmd->env, --n); + unsetbuf[n] = '\0'; + unsetenv(unsetbuf); + } else + putenv((char*)*cmd->env); + } + free(unsetbuf); } if (cmd->git_cmd) { execv_git_cmd(cmd->argv); -- 1.5.2.51.g16099 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html