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>
return current_exec_path;
env = getenv("GIT_EXEC_PATH");
- if (env) {
+ if (env && *env) {
return env;
}
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))) {