From: Dmitry V. Levin Date: Mon, 29 May 2006 00:34:34 +0000 (+0400) Subject: git_exec_path, execv_git_cmd: ignore empty environment variables X-Git-Tag: v1.4.0-rc1~25 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2b6016263c984b71b29373fc9354d497cd51947d;p=git.git git_exec_path, execv_git_cmd: ignore empty environment variables Ignoring empty environment variables is good common practice. Ignoring --exec-path with empty argument won't harm, too: if user means current directory, there is a "--exec-path=." Signed-off-by: Dmitry V. Levin Signed-off-by: Junio C Hamano --- diff --git a/exec_cmd.c b/exec_cmd.c index 12eb36494..c1539d12c 100644 --- a/exec_cmd.c +++ b/exec_cmd.c @@ -21,7 +21,7 @@ const char *git_exec_path(void) return current_exec_path; env = getenv("GIT_EXEC_PATH"); - if (env) { + if (env && *env) { return env; } @@ -43,7 +43,7 @@ int execv_git_cmd(const char **argv) const char *exec_dir = paths[i]; const char *tmp; - if (!exec_dir) continue; + if (!exec_dir || !*exec_dir) continue; if (*exec_dir != '/') { if (!getcwd(git_command, sizeof(git_command))) {