OSDN Git Service

* spawn.cc (av::fixup): Treat non-readable, but executable files as
authorcorinna <corinna>
Mon, 19 Oct 2009 08:33:00 +0000 (08:33 +0000)
committercorinna <corinna>
Mon, 19 Oct 2009 08:33:00 +0000 (08:33 +0000)
Cygwin executables.

winsup/cygwin/ChangeLog
winsup/cygwin/spawn.cc

index 4bf59b6..2f35b71 100644 (file)
@@ -1,3 +1,8 @@
+2009-10-19  Corinna Vinschen  <corinna@vinschen.de>
+
+       * spawn.cc (av::fixup): Treat non-readable, but executable files as
+       Cygwin executables.
+
 2009-10-18  Corinna Vinschen  <corinna@vinschen.de>
 
        * uinfo.cc (uinfo_init): Deimpersonate, don't reimpersonate, if
index a6ac9f0..f4c208d 100644 (file)
@@ -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);