summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-15 17:26:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-15 17:26:29 +0000
commit73437c05f57aec9dd1d2438ed8e8962f28415505 (patch)
treeb5ac4b935fdd976390663c61a3cd60293d321a8d
parent2625e3425deb108a688da91bbeacb02c3461a71f (diff)
* ruby.c (process_options): dln_find_file returns the pointer to a
static buffer, so should copy it. [ruby-dev:34409] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ruby.c18
-rw-r--r--version.h6
3 files changed, 18 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index d570e7116a..fdc16731f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Apr 16 02:26:27 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (process_options): dln_find_file returns the pointer to a
+ static buffer, so should copy it. [ruby-dev:34409]
+
Tue Apr 15 23:08:46 2008 Kouhei Sutou <kou@cozmixng.org>
* lib/xmlrpc/client.rb: fix cookie handling. [ruby-dev:34403]
diff --git a/ruby.c b/ruby.c
index 7676da1fc7..e555191e65 100644
--- a/ruby.c
+++ b/ruby.c
@@ -84,6 +84,7 @@ struct cmdline_options {
int verbose;
int yydebug;
char *script;
+ VALUE script_name;
VALUE e_script;
struct {
struct {
@@ -934,6 +935,8 @@ opt_enc_index(VALUE enc_name)
return i;
}
+VALUE rb_progname;
+VALUE rb_argv0;
static int src_encoding_index = -1; /* TODO: VM private */
static VALUE
@@ -1034,16 +1037,17 @@ process_options(VALUE arg)
if (!opt->script)
opt->script = argv[0];
}
-#if defined DOSISH || defined __CYGWIN__
- /* assume that we can change argv[n] if never change its length. */
- translate_char(opt->script, '\\', '/');
-#endif
argc--;
argv++;
}
}
ruby_script(opt->script);
+#if defined DOSISH || defined __CYGWIN__
+ translate_char(RSTRING_PTR(rb_progname), '\\', '/');
+#endif
+ opt->script_name = rb_str_new4(rb_progname);
+ opt->script = RSTRING_PTR(opt->script_name);
ruby_set_argv(argc, argv);
process_sflag(opt);
@@ -1108,7 +1112,7 @@ process_options(VALUE arg)
}
return rb_iseq_new(tree, rb_str_new2("<main>"),
- rb_str_new2(opt->script), Qfalse, ISEQ_TYPE_TOP);
+ opt->script_name, Qfalse, ISEQ_TYPE_TOP);
}
static NODE *
@@ -1270,9 +1274,6 @@ rb_load_file(const char *fname)
return load_file(rb_parser_new(), fname, 0, &opt);
}
-VALUE rb_progname;
-VALUE rb_argv0;
-
#if !defined(PSTAT_SETCMD) && !defined(HAVE_SETPROCTITLE)
#if !defined(_WIN32) && !(defined(HAVE_SETENV) && defined(HAVE_UNSETENV))
#define USE_ENVSPACE_FOR_ARG0
@@ -1288,6 +1289,7 @@ get_arglen(int argc, char **argv)
char *s = argv[0];
int i;
+ if (!argc) return 0;
s += strlen(s);
/* See if all the arguments are contiguous in memory */
for (i = 1; i < argc; i++) {
diff --git a/version.h b/version.h
index cf542676fc..7369b4fb7e 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2008-04-15"
+#define RUBY_RELEASE_DATE "2008-04-16"
#define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20080415
+#define RUBY_RELEASE_CODE 20080416
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 4
-#define RUBY_RELEASE_DAY 15
+#define RUBY_RELEASE_DAY 16
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];