Hi,

On Thu, 26 Jun 2008, Eric Raible wrote:

> 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);

It would be much more logical to keep the original semantics, and do this 
instead of your patch:

-       if ((!exe_only || isexe) && access(path, F_OK) == 0)
+       if ((!exe_only || isexe) && access(path, F_OK) == 0 &&
+                       !(GetFileAttributes(path) & 
+                               FILE_ATTRIBUTE_DIRECTORY))

Ciao,
Dscho

Reply via email to