summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-04 07:26:47 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-04 07:26:47 +0000
commitd9d3a1b2fb10e01d8ace6aa2addeca964ea2f573 (patch)
treec2c33a8c233ddf3e4b6fd8d5bacdf2e11bd3f676 /process.c
parent1165542a92724aadfa5007c47cfae7a631af669e (diff)
* io.c (pipe_open): command name should not contain null bytes.
[ruby-dev:29421] * process.c (proc_spawn): ditto. * process.c (proc_spawn_n): ditto. * process.c (rb_f_system): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/process.c b/process.c
index a473fe9919..3aaf689621 100644
--- a/process.c
+++ b/process.c
@@ -1136,13 +1136,13 @@ proc_spawn_n(argc, argv, prog)
args = ALLOCA_N(char*, argc + 1);
for (i = 0; i < argc; i++) {
SafeStringValue(argv[i]);
- args[i] = RSTRING(argv[i])->ptr;
+ args[i] = StringValueCStr(argv[i]);
}
if (prog)
SafeStringValue(prog);
args[i] = (char*) 0;
if (args[0])
- return proc_spawn_v(args, prog ? RSTRING(prog)->ptr : 0);
+ return proc_spawn_v(args, prog ? StringValueCStr(prog) : 0);
return -1;
}
@@ -1157,7 +1157,7 @@ proc_spawn(sv)
int status;
SafeStringValue(sv);
- str = s = RSTRING(sv)->ptr;
+ str = s = StringValueCStr(sv);
for (s = str; *s; s++) {
if (*s != ' ' && !ISALPHA(*s) && strchr("*?{}[]<>()~&|\\$;'`\"\n",*s)) {
char *shell = dln_find_exe("sh", 0);
@@ -1458,7 +1458,7 @@ rb_f_system(argc, argv)
if (argc == 1 && prog == 0) {
#if defined(_WIN32)
SafeStringValue(argv[0]);
- status = do_spawn(P_WAIT, RSTRING(argv[0])->ptr);
+ status = do_spawn(P_WAIT, StringValueCStr(argv[0]));
#else
status = proc_spawn(argv[0]);
#endif
@@ -1486,7 +1486,7 @@ rb_f_system(argc, argv)
cmd = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
SafeStringValue(cmd);
- status = system(RSTRING(cmd)->ptr);
+ status = system(StringValueCStr(cmd));
last_status_set((status & 0xff) << 8, 0);
#else
volatile VALUE prog = 0;
@@ -1511,9 +1511,11 @@ rb_f_system(argc, argv)
if (prog) {
SafeStringValue(prog);
+ StringValueCStr(prog);
}
for (i = 0; i < argc; i++) {
SafeStringValue(argv[i]);
+ StringValueCStr(argv[i]);
}
security(RSTRING(prog ? prog : argv[0])->ptr);
chfunc = signal(SIGCHLD, SIG_DFL);