summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-08 15:03:23 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-08 15:03:23 +0000
commit117a7c052baeecea42b46634c31dfda3a2f8aac1 (patch)
treeddd8dce8b7845741a12bb53946c535b6b0028eda /ruby.c
parent28b376e76b39492e2cb6c74eddab8c53ec8bd89f (diff)
merges r28836 from trunk into ruby_1_9_2.
-- * ruby.c (ruby_init_loadpath_safe): rb_str_set_len modifies ptr since r26303. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ruby.c b/ruby.c
index e7c73b352f..e61711d9a0 100644
--- a/ruby.c
+++ b/ruby.c
@@ -419,13 +419,15 @@ ruby_init_loadpath_safe(int safe_level)
strlcpy(libpath, ".", sizeof(libpath));
p = libpath + 1;
}
+ baselen = p - libpath;
#define PREFIX_PATH() rb_str_new(libpath, baselen)
#else
- rb_str_set_len(sopath, p - libpath);
+ baselen = p - libpath;
+ rb_str_set_len(sopath, baselen);
+ libpath = RSTRING_PTR(sopath);
#define PREFIX_PATH() sopath
#endif
- baselen = p - libpath;
#define BASEPATH() rb_str_buf_cat(rb_str_buf_new(baselen+len), libpath, baselen)
#define RUBY_RELATIVE(path, len) rb_str_buf_cat(BASEPATH(), path, len)