diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-10 21:12:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-10 21:12:49 +0000 |
commit | 745bc1fd83595c869e9d4b3e5e933e332a6c7c8d (patch) | |
tree | 8378f1e1050ad9cfa5baf6ed47c7a9ba9f115cd1 /ruby.c | |
parent | 8231655dea0c216d9a3bd08796a43ddb3399d699 (diff) | |
download | ruby-745bc1fd83595c869e9d4b3e5e933e332a6c7c8d.tar.gz |
* ruby.c (ruby_init_loadpath_safe): expands libpath and removes
last /lib.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -348,15 +348,15 @@ ruby_init_loadpath_safe(int safe_level) char *p; int baselen; - libpath[0] = '\0'; #if defined _WIN32 || defined __CYGWIN__ GetModuleFileName(libruby, libpath, sizeof libpath); #elif defined(__EMX__) _execname(libpath, sizeof(libpath) - 1); #elif defined(HAVE_DLADDR) Dl_info dli; + libpath[0] = '\0'; if (dladdr(expand_include_path, &dli)) { - strlcpy(libpath, dli.dli_fname, sizeof(libpath)); + realpath(dli.dli_fname, libpath); } #endif @@ -373,7 +373,7 @@ ruby_init_loadpath_safe(int safe_level) p = strrchr(libpath, '/'); if (p) { *p = 0; - if (p - libpath > 3 && !STRCASECMP(p - 4, "/bin")) { + if (p - libpath > 3 && !(STRCASECMP(p - 4, "/bin") && strcmp(p - 4, "/lib"))) { p -= 4; *p = 0; } |