mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
8231655dea
commit
745bc1fd83
2 changed files with 8 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Mar 11 06:12:47 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby.c (ruby_init_loadpath_safe): expands libpath and removes
|
||||
last /lib.
|
||||
|
||||
Wed Mar 11 04:47:47 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* time.c (time_to_i, time_hash): time_t may be bigger than long
|
||||
|
|
6
ruby.c
6
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue