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 <[EMAIL PROTECTED]>
---
Note that we needn't check for error return from GetFileAttributes()
b.c. after access() returns 0 GetFileAttributes()'s success is ensured.
Even if it's not, the error return is 0xFFFFFFFF so we'd correctly return
NULL anyway.
compat/mingw.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index 5499a95..ab5d966 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -523,9 +523,10 @@ static char *lookup_prog(const char *dir, const char *cmd,
int isexe, int exe_on
if (!isexe && access(path, F_OK) == 0)
return xstrdup(path);
path[strlen(path)-4] = '\0';
- if ((!exe_only || isexe) && access(path, F_OK) == 0)
- return xstrdup(path);
- return NULL;
+ if ((exe_only && !isexe) || access(path, F_OK) ||
+ (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY))
+ return NULL;
+ return xstrdup(path);
}
/*
--
1.5.6.1063.g1fa16.dirty