[前][次][番号順一覧][スレッド一覧]

ruby-changes:11270

From: nobu <ko1@a...>
Date: Wed, 11 Mar 2009 06:13:00 +0900 (JST)
Subject: [ruby-changes:11270] Ruby:r22881 (trunk): * ruby.c (ruby_init_loadpath_safe): expands libpath and removes

nobu	2009-03-11 06:12:49 +0900 (Wed, 11 Mar 2009)

  New Revision: 22881

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22881

  Log:
    * ruby.c (ruby_init_loadpath_safe): expands libpath and removes
      last /lib.

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 22880)
+++ ChangeLog	(revision 22881)
@@ -1,3 +1,8 @@
+Wed Mar 11 06:12:47 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* ruby.c (ruby_init_loadpath_safe): expands libpath and removes
+	  last /lib.
+
 Wed Mar 11 04:47:47 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* time.c (time_to_i, time_hash): time_t may be bigger than long
Index: ruby.c
===================================================================
--- ruby.c	(revision 22880)
+++ ruby.c	(revision 22881)
@@ -348,15 +348,15 @@
     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 @@
     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;
 	}

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]