summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/spawn.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 7f7af4449..d95772802 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -1172,6 +1172,12 @@ av::setup (const char *prog_arg, path_conv& real_path, const char *ext,
}
UnmapViewOfFile (buf);
just_shell:
+ /* Check if script is executable. Otherwise we start non-executable
+ scripts successfully, which is incorrect behaviour. */
+ if (real_path.has_acls ()
+ && check_file_access (real_path, X_OK, true) < 0)
+ return -1; /* errno is already set. */
+
if (!pgm)
{
if (!p_type_exec)
@@ -1188,12 +1194,6 @@ av::setup (const char *prog_arg, path_conv& real_path, const char *ext,
arg1 = NULL;
}
- /* Check if script is executable. Otherwise we start non-executable
- scripts successfully, which is incorrect behaviour. */
- if (real_path.has_acls ()
- && check_file_access (real_path, X_OK, true) < 0)
- return -1; /* errno is already set. */
-
/* Replace argv[0] with the full path to the script if this is the
first time through the loop. */
replace0_maybe (prog_arg);