summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_disk_file.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-10-09 14:23:09 +0000
committerCorinna Vinschen <corinna@vinschen.de>2008-10-09 14:23:09 +0000
commit079db16bf7ae41fa9a09640296bb2f3031971d08 (patch)
treeda667ee4e8f9cb5363267e70b9331b39046c9ab0 /winsup/cygwin/fhandler_disk_file.cc
parent3059d18288015dfee47e590705c06f0520598d05 (diff)
downloadcygnal-079db16bf7ae41fa9a09640296bb2f3031971d08.tar.gz
cygnal-079db16bf7ae41fa9a09640296bb2f3031971d08.tar.bz2
cygnal-079db16bf7ae41fa9a09640296bb2f3031971d08.zip
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Check
for executable suffixes here in case we're on a file system not supporting permission. * path.cc (path_conv::check): Drop check for executable suffixes.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index aa945f588..e3c9aaf93 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -609,6 +609,18 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
else
{
buf->st_mode |= S_IFREG;
+ /* Check suffix for executable file. */
+ if (pc.exec_state () == dont_know_if_executable)
+ {
+ PUNICODE_STRING path = pc.get_nt_native_path ();
+
+ if (RtlEqualUnicodePathSuffix (path, L".exe", TRUE)
+ || RtlEqualUnicodePathSuffix (path, L".bat", TRUE)
+ || RtlEqualUnicodePathSuffix (path, L".com", TRUE))
+ pc.set_exec ();
+ }
+ /* No known sufix, check file header. This catches binaries and
+ shebang scripts. */
if (pc.exec_state () == dont_know_if_executable)
{
UNICODE_STRING same;