summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-29 09:36:28 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-29 09:36:28 +0000
commit08c47c5515b3e247f75b6fb129cc5466e5ff3c85 (patch)
tree7069dc3a273a0f988eeeaccc675d40e94203d5d3 /ruby.c
parent438d40d932f58b24fb72f286d0610376e83bd89a (diff)
merge revision(s) 17586,17612:
* ruby.c (set_arg0, ruby_prog_init): freeze $0. a patch from Keita Yamaguchi <keita.yamaguchi at gmail.com>. * test/inlinetest.rb (InlineTest.in_progname): workaround for frozen $0. [ruby-dev:35261] * lib/test/unit/ui/console/testrunner.rb (TestRunner#finished): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@17702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ruby.c b/ruby.c
index bb7a9d0cda..dafca05c7e 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1034,6 +1034,7 @@ set_arg0(val, id)
VALUE val;
ID id;
{
+ VALUE progname;
char *s;
long i;
#if !defined(PSTAT_SETCMD) && !defined(HAVE_SETPROCTITLE)
@@ -1058,10 +1059,10 @@ set_arg0(val, id)
j.pst_command = s;
pstat(PSTAT_SETCMD, j, i, 0, 0);
}
- rb_progname = rb_tainted_str_new(s, i);
+ progname = rb_tainted_str_new(s, i);
#elif defined(HAVE_SETPROCTITLE)
setproctitle("%.*s", (int)i, s);
- rb_progname = rb_tainted_str_new(s, i);
+ progname = rb_tainted_str_new(s, i);
#else
if (len == 0) {
char *s = origargv[0];
@@ -1096,8 +1097,9 @@ set_arg0(val, id)
if (++i < len) memset(s + 1, ' ', len - i);
for (i = 1; i < origargc; i++)
origargv[i] = s;
- rb_progname = rb_tainted_str_new2(origargv[0]);
+ progname = rb_tainted_str_new2(origargv[0]);
#endif
+ rb_progname = rb_obj_freeze(progname);
}
void
@@ -1105,7 +1107,7 @@ ruby_script(name)
const char *name;
{
if (name) {
- rb_progname = rb_tainted_str_new2(name);
+ rb_progname = rb_obj_freeze(rb_tainted_str_new2(name));
ruby_sourcefile = rb_source_filename(name);
}
}