diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-02-01 00:49:39 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-02-01 00:49:39 +0300 |
commit | 4b84e3dceab3c8a9004ae2f2aac53741ce24b308 (patch) | |
tree | e59f6d7794be8b844e72f46047928502891f2bc0 /winsup | |
parent | fd34affe5d4d0ee0a168ea6d721eb9d037305d92 (diff) |
* dlfcn.cc (check_path_access): Call find_exec with FE_DLL option.
* path.h (enum fe_types): Add FE_DLL value.
* spawn.cc (std_suffixes): Remove.
(exe_suffixes): New suffix_info for executing files.
(dll_suffixes): New suffix_info for searching shared libraries.
(perhaps_suffix): Add opt argument. Use dll_suffixes if FE_DLL
option is given, exe_suffixes otherwise.
(find_exec): Propagate opt argument to perhaps_suffix. Drop suffix
check when testing execute permission.
(spawn_guts): Call perhaps_suffix with FE_NADA opt argument.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 13 | ||||
-rw-r--r-- | winsup/cygwin/dlfcn.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/path.h | 3 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 26 |
4 files changed, 31 insertions, 13 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 33607f4b3..8e9c3f04d 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,16 @@ +2006-01-31 Corinna Vinschen <corinna@vinschen.de> + + * dlfcn.cc (check_path_access): Call find_exec with FE_DLL option. + * path.h (enum fe_types): Add FE_DLL value. + * spawn.cc (std_suffixes): Remove. + (exe_suffixes): New suffix_info for executing files. + (dll_suffixes): New suffix_info for searching shared libraries. + (perhaps_suffix): Add opt argument. Use dll_suffixes if FE_DLL + option is given, exe_suffixes otherwise. + (find_exec): Propagate opt argument to perhaps_suffix. Drop suffix + check when testing execute permission. + (spawn_guts): Call perhaps_suffix with FE_NADA opt argument. + 2006-01-31 Christopher Faylor <cgf@timesys.com> * spawn.cc (av::fixup): Remove unused argument. diff --git a/winsup/cygwin/dlfcn.cc b/winsup/cygwin/dlfcn.cc index 5d0fb6d8f..5bea77419 100644 --- a/winsup/cygwin/dlfcn.cc +++ b/winsup/cygwin/dlfcn.cc @@ -37,7 +37,7 @@ set_dl_error (const char *str) inline const char * __stdcall check_path_access (const char *mywinenv, const char *name, path_conv& buf) { - return find_exec (name, buf, mywinenv, FE_NNF | FE_NATIVE | FE_CWD); + return find_exec (name, buf, mywinenv, FE_NNF | FE_NATIVE | FE_CWD | FE_DLL); } /* Search LD_LIBRARY_PATH for dll, if it exists. diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 6bd18742f..9bc582bd0 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -266,7 +266,8 @@ enum fe_types FE_NADA = 0, /* Nothing special */ FE_NNF = 1, /* Return NULL if not found */ FE_NATIVE = 2, /* Return native path in path_conv struct */ - FE_CWD = 4 /* Search CWD for program */ + FE_CWD = 4, /* Search CWD for program */ + FE_DLL = 8 /* Search for DLLs, not executables. */ }; const char * __stdcall find_exec (const char *name, path_conv& buf, const char *winenv = "PATH=", diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index f906dce68..b56d8bb65 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -37,11 +37,16 @@ details. */ #define LINE_BUF_CHUNK (CYG_MAX_PATH * 2) #define MAXWINCMDLEN 32767 -static suffix_info std_suffixes[] = +static suffix_info exe_suffixes[] = { suffix_info (".exe", 1), suffix_info ("", 1), - suffix_info (".com"), suffix_info (".cmd"), - suffix_info (".bat"), suffix_info (".dll"), + suffix_info (".com"), + suffix_info (NULL) +}; + +static suffix_info dll_suffixes[] = +{ + suffix_info (".dll"), suffix_info (NULL) }; @@ -55,13 +60,14 @@ DWORD dwExeced; Returns (possibly NULL) suffix */ static const char * -perhaps_suffix (const char *prog, path_conv& buf, int& err) +perhaps_suffix (const char *prog, path_conv& buf, int& err, unsigned opt) { char *ext; err = 0; debug_printf ("prog '%s'", prog); - buf.check (prog, PC_SYM_FOLLOW | PC_NULLEMPTY, std_suffixes); + buf.check (prog, PC_SYM_FOLLOW | PC_NULLEMPTY, + (opt & FE_DLL) ? dll_suffixes : exe_suffixes); if (buf.isdir ()) { @@ -106,7 +112,7 @@ find_exec (const char *name, path_conv& buf, const char *mywinenv, Win32 systems always check . first, but PATH may not be set up to do this. */ if ((has_slash || opt & FE_CWD) - && (suffix = perhaps_suffix (name, buf, err)) != NULL) + && (suffix = perhaps_suffix (name, buf, err, opt)) != NULL) { if (posix && !has_slash) { @@ -160,11 +166,9 @@ find_exec (const char *name, path_conv& buf, const char *mywinenv, debug_printf ("trying %s", tmp); - if ((suffix = perhaps_suffix (tmp, buf, err)) != NULL) + if ((suffix = perhaps_suffix (tmp, buf, err, opt)) != NULL) { - if (buf.has_acls () && allow_ntsec - && (*suffix == '\0' || strcmp (suffix, ".exe")) - && check_file_access (buf, X_OK)) + if (buf.has_acls () && allow_ntsec && check_file_access (buf, X_OK)) continue; if (posix == tmp) @@ -469,7 +473,7 @@ spawn_guts (const char * prog_arg, const char *const *argv, int err; const char *ext; - if ((ext = perhaps_suffix (prog_arg, real_path, err)) == NULL) + if ((ext = perhaps_suffix (prog_arg, real_path, err, FE_NADA)) == NULL) { set_errno (err); res = -1; |