summaryrefslogtreecommitdiffstats
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-10 21:12:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-10 21:12:49 +0000
commitc7efe853c063f98bdc75c556f00c97cdc7cdc6de (patch)
tree8378f1e1050ad9cfa5baf6ed47c7a9ba9f115cd1 /ruby.c
parenteeac761f609aa982cd30aa57b4a137e5a9f0fb84 (diff)
downloadruby-c7efe853c063f98bdc75c556f00c97cdc7cdc6de.tar.gz
ruby-c7efe853c063f98bdc75c556f00c97cdc7cdc6de.tar.xz
ruby-c7efe853c063f98bdc75c556f00c97cdc7cdc6de.zip
* ruby.c (ruby_init_loadpath_safe): expands libpath and removes
last /lib. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ruby.c b/ruby.c
index 2091cec9e..0fff0033a 100644
--- a/ruby.c
+++ b/ruby.c
@@ -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;
}