aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-11-02 14:39:08 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-11-02 14:39:08 +0000
commitdf95867087d4e39ec232aac92ffc111bfe565f18 (patch)
treebee90aead405ac6c33e45295c473a09c45ce3014 /winsup/cygwin
parent09b07be52081b6c5eacecef273a2ce3b58953715 (diff)
downloadnewlib-df95867087d4e39ec232aac92ffc111bfe565f18.zip
newlib-df95867087d4e39ec232aac92ffc111bfe565f18.tar.gz
newlib-df95867087d4e39ec232aac92ffc111bfe565f18.tar.bz2
* dlfcn.cc (get_full_path_of_dll): Drop enforcing a .dll suffix.
(dlopen): If last path component has no dot, append one to override automatic .dll suffix in LoadLibrary.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/dlfcn.cc15
2 files changed, 12 insertions, 9 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 99fcb9d..c19de62 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2009-11-02 Corinna Vinschen <corinna@vinschen.de>
+ * dlfcn.cc (get_full_path_of_dll): Drop enforcing a .dll suffix.
+ (dlopen): If last path component has no dot, append one to override
+ automatic .dll suffix in LoadLibrary.
+
+2009-11-02 Corinna Vinschen <corinna@vinschen.de>
+
* miscfuncs.h (transform_chars): Declare. Define inline variation here.
* mount.cc (mount_info::from_fstab): Remove extern declaration of
transform_chars.
diff --git a/winsup/cygwin/dlfcn.cc b/winsup/cygwin/dlfcn.cc
index bc95e22..e62d74c 100644
--- a/winsup/cygwin/dlfcn.cc
+++ b/winsup/cygwin/dlfcn.cc
@@ -53,15 +53,6 @@ get_full_path_of_dll (const char* str, path_conv &real_filename)
strcpy (name, str); /* Put it somewhere where we can manipulate it. */
- /* Add extension if necessary */
- if (str[len - 1] != '.')
- {
- /* Add .dll only if no extension provided. */
- const char *p = strrchr (str, '.');
- if (!p || strpbrk (p, "\\/"))
- strcat (name, ".dll");
- }
-
if (isabspath (name) ||
(check_path_access ("LD_LIBRARY_PATH=", name, real_filename)
?: check_path_access ("/usr/lib", name, real_filename)) == NULL)
@@ -93,6 +84,12 @@ dlopen (const char *name, int)
wchar_t *path = tp.w_get ();
pc.get_wide_win32_path (path);
+ /* Check if the last path component contains a dot. If so,
+ leave the filename alone. Otherwise add a traiing dot
+ to override LoadLibrary's automatic adding of a ".dll" suffix. */
+ wchar_t *last_bs = wcsrchr (path, L'\\');
+ if (last_bs && !wcschr (last_bs, L'.'))
+ wcscat (last_bs, L".");
/* Workaround for broken DLLs built against Cygwin versions 1.7.0-49
up to 1.7.0-57. They override the cxx_malloc pointer in their