summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-11 02:28:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-11 02:28:59 +0000
commitb068def1ab1859b7a8e9dff255cf24568e356cb8 (patch)
tree55816d0aa5de489bad9c55e4d833d1ca4c1c801f /ruby.c
parentef9528cefe715036f1c7d1ef294417379b72e41d (diff)
* ruby.c (ruby_init_loadpath): fix for the length of mangled path.
[ruby-core:29398] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@27298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ruby.c b/ruby.c
index 9483c6ae1e..75762ae57f 100644
--- a/ruby.c
+++ b/ruby.c
@@ -306,13 +306,13 @@ ruby_init_loadpath()
baselen = p - libpath;
rest = FILENAME_MAX - baselen;
-#define RUBY_RELATIVE(path) (strncpy(p, (path), rest), libpath)
+#define RUBY_RELATIVE(path, len) (strncpy(p, (path), rest), rubylib_mangled_path(libpath, baselen+(len)))
#else
static const char exec_prefix[] = RUBY_EXEC_PREFIX;
-#define RUBY_RELATIVE(path) (path)
-#define PREFIX_PATH() rubylib_mangled_path(exec_prefix, sizeof(exec_prefix)-1)
+#define RUBY_RELATIVE(path, len) rubylib_mangled_path(path, len)
+#define PREFIX_PATH() RUBY_RELATIVE(exec_prefix, sizeof(exec_prefix)-1)
#endif
-#define incpush(path, len) rb_ary_push(rb_load_path, rubylib_mangled_path(path, len))
+#define incpush(path) rb_ary_push(rb_load_path, (path))
if (rb_safe_level() == 0) {
ruby_incpush(getenv("RUBYLIB"));
@@ -320,12 +320,12 @@ ruby_init_loadpath()
while (*paths) {
size_t len = strlen(paths);
- incpush(RUBY_RELATIVE(paths), len);
+ incpush(RUBY_RELATIVE(paths, len));
paths += len + 1;
}
if (rb_safe_level() == 0) {
- incpush(".", 1);
+ incpush(rb_str_new2("."));
}
rb_const_set(rb_cObject, rb_intern("TMP_RUBY_PREFIX"), rb_obj_freeze(PREFIX_PATH()));