summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-10-19 08:33:00 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-10-19 08:33:00 +0000
commitb3f5fb37182a05a65f36256f79563e087fc4975d (patch)
treec2f010df77c87b077c47499a5d776e63dea92977 /winsup/cygwin/spawn.cc
parenta6f3658d44c4f5fdd78b20fa07e3ecc7aabe9f23 (diff)
downloadcygnal-b3f5fb37182a05a65f36256f79563e087fc4975d.tar.gz
cygnal-b3f5fb37182a05a65f36256f79563e087fc4975d.tar.bz2
cygnal-b3f5fb37182a05a65f36256f79563e087fc4975d.zip
* spawn.cc (av::fixup): Treat non-readable, but executable files as
Cygwin executables.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index a6ac9f0e7..f4c208d09 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -1003,7 +1003,18 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext)
| FILE_OPEN_FOR_BACKUP_INTENT
| FILE_NON_DIRECTORY_FILE);
if (!NT_SUCCESS (status))
- goto err;
+ {
+ /* File is not readable? Doesn't mean it's not executable.
+ Test for executablility and if so, just assume the file is
+ a cygwin executable and go ahead. */
+ if (status == STATUS_ACCESS_DENIED && real_path.has_acls ()
+ && check_file_access (real_path, X_OK, true) == 0)
+ {
+ real_path.set_cygexec (true);
+ break;
+ }
+ goto err;
+ }
HANDLE hm = CreateFileMapping (h, &sec_none_nih, PAGE_READONLY, 0, 0, NULL);
NtClose (h);