winegcc: Fix the file mode check.

This commit is contained in:
Alexandre Julliard 2008-12-12 12:01:46 +01:00
parent de5bbbc2ff
commit f12e9a026b
1 changed files with 3 additions and 6 deletions

View File

@ -307,13 +307,10 @@ void spawn(const strarray* prefix, const strarray* args, int ignore_errors)
if (!(p = strrchr(argv[0], '/'))) p = argv[0];
free( prog );
prog = strmake("%s/%s", prefix->base[i], p);
if (stat(prog, &st) == 0)
if (stat(prog, &st) == 0 && S_ISREG(st.st_mode) && (st.st_mode & 0111))
{
if ((st.st_mode & S_IFREG) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
{
argv[0] = prog;
break;
}
argv[0] = prog;
break;
}
}
}