From 95a8465ba0fb3ea0fb9033e4823b1f65c4554f27 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 5 Mar 2001 06:28:25 +0000 Subject: * dlopen.c (dlopen): Return NULL when name is NULL (suggested by chrisiasci@aol.com). * cygwin.din: Add a new, internally used export - _check_for_executable. * dcrt0.cc (dll_crt0_1): Set _check_for_executable for older binaries. Pass user_data to premain functions. * fhandler.cc (fhandler_disk_file::open): Only check for executable if the linked program is intereested in the executable bit. (fhandler_disk_file::check_execable_p): Delete. * fhandler.h (executable_states): New enumeration of various states of executable bit caring. (fhandler_base::set_execable_p): New method. * fhandler_termios.cc (fhandler_termios::line_edit): Flag when a signal has been sent to the tty. Return -1 when this is so. * fhandler_console.cc (fhandler_console::read): Return -1 when signal sending character encountered. * path.cc (path_conv::check): Record when path refers to a disk device. Move executable extension check here. (check_sysfile): Accomodate new EXEC path states. (has_suffix): Remove. (next_suffix): Remove. (class suffix_scan): New clas. (suffix_scan::has): New method. (suffix_scan:next): New method. (symlink_info::check): Use suffix_scan method to control for scanning for suffixes. * path.h (path_conv::exec_state): New method. * perprocess.h: Make "C" friendly. * include/cygwin/version.h: Define CYGWIN_VERSION_CHECK_FOR_S_IEXEC. Bump CYGWIN_VERSION_API_MINOR. * include/sys/cygwin.h: Change premain declarations. * winsup.h: Move __cplusplus test to after builtin defines. --- winsup/cygwin/fhandler.cc | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'winsup/cygwin/fhandler.cc') diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 40aa50849..82fa034cd 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -17,11 +17,11 @@ details. */ #include #include #include "cygerrno.h" +#include "perprocess.h" #include "fhandler.h" #include "path.h" #include "shared_info.h" #include "host_dependent.h" -#include "perprocess.h" #include "security.h" static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */ @@ -1226,9 +1226,6 @@ fhandler_disk_file::open (path_conv& real_path, int flags, mode_t mode) win32_path_name_ = real_path.get_win32 (); set_no_free_names (); } - /* If necessary, do various other things to see if path is a program. */ - if (!real_path.isexec ()) - real_path.set_exec (check_execable_p (get_win32_name ())); if (real_path.isbinary ()) { @@ -1264,9 +1261,9 @@ fhandler_disk_file::open (path_conv& real_path, int flags, mode_t mode) extern BOOL allow_ntea; - if (!real_path.isexec () && !allow_ntea - && (!allow_ntsec || !real_path.has_acls ()) - && GetFileType (get_handle ()) == FILE_TYPE_DISK) + if (real_path.isdisk () + && (real_path.exec_state () == dont_know_if_executable) + && !allow_ntea && (!allow_ntsec || !real_path.has_acls ())) { DWORD done; char magic[3]; @@ -1283,7 +1280,7 @@ fhandler_disk_file::open (path_conv& real_path, int flags, mode_t mode) SetFilePointer (get_handle(), 0, 0, FILE_END); set_symlink_p (real_path.issymlink ()); - set_execable_p (real_path.isexec ()); + set_execable_p (real_path.exec_state ()); set_socket_p (real_path.issocket ()); out: @@ -1457,21 +1454,6 @@ fhandler_disk_file::lock (int cmd, struct flock *fl) return 0; } -/* Perform various heuristics on PATH to see if it's a program. */ - -int -fhandler_disk_file::check_execable_p (const char *path) -{ - int len = strlen (path); - const char *ch = path + (len > 4 ? len - 4 : len); - - if (strcasematch (".exe", ch) - || strcasematch (".bat", ch) - || strcasematch (".com", ch)) - return 1; - return 0; -} - /**********************************************************************/ /* /dev/null */ -- cgit v1.2.3