From a761ad820081c0a6fd907be0a87ae7fbde7e24c8 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 29 May 2002 03:06:37 +0000 Subject: * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Properly check for whether we should be opening the file to search for #! characters. Set path_conv structure execability, too, if found. --- winsup/cygwin/fhandler_disk_file.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/fhandler_disk_file.cc') diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index a1237cc3c..de8476445 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -266,7 +266,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, else { buf->st_mode |= S_IFREG; - if (!pc->exec_state () == dont_know_if_executable) + if (pc->exec_state () == dont_know_if_executable) { DWORD cur, done; char magic[3]; @@ -283,7 +283,10 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, magic[0] = magic[1] = magic[2] = '\0'; if (ReadFile (get_handle (), magic, 3, &done, NULL) && has_exec_chars (magic, done)) + { set_execable_p (); + pc->set_exec (); + } SetFilePointer (get_handle(), cur, NULL, FILE_BEGIN); } } -- cgit v1.2.3