From: Eric Raible Date: Fri, 18 Jul 2008 07:34:42 +0000 (+0200) Subject: Teach lookup_prog not to select directories X-Git-Tag: v1.6.0-rc0~24 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fe77b6959c47e1eaec0c96599b2c5ce7907707ec;p=git.git Teach lookup_prog not to select directories Without this simple fix "git gui" in the git source directory finds the git-gui directory instead of the tcl script in /usr/bin. Signed-off-by: Eric Raible Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- diff --git a/compat/mingw.c b/compat/mingw.c index c0bc849e4..772cad510 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -536,7 +536,8 @@ static char *lookup_prog(const char *dir, const char *cmd, int isexe, int exe_on return xstrdup(path); path[strlen(path)-4] = '\0'; if ((!exe_only || isexe) && access(path, F_OK) == 0) - return xstrdup(path); + if (!(GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY)) + return xstrdup(path); return NULL; }