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 <ldv@altlinux.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Dmitry V. Levin committed
May 29, 2006 at 04:34 UTC
2b6016263c984b71b29373fc9354d497cd51947d
1 file changed
+2
-2
exec_cmd.c
+2
-2
@@ -21,7 +21,7 @@ const char *git_exec_path(void)
21
return current_exec_path;
22
23
env = getenv("GIT_EXEC_PATH");
24
- if (env) {
24
+ if (env && *env) {
25
return env;
26
}
27
@@ -43,7 +43,7 @@ int execv_git_cmd(const char **argv)
43
const char *exec_dir = paths[i];
44
const char *tmp;
45
46
- if (!exec_dir) continue;
46
+ if (!exec_dir || !*exec_dir) continue;
47
48
if (*exec_dir != '/') {
49
if (!getcwd(git_command, sizeof(git_command))) {