summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-14 05:46:43 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-14 05:46:43 +0000
commitec5e44f2c704d6e47159b5f61ec761e7b2a7a76a (patch)
treef510225abef4c2aad2b2d952d8850ae0fa9c9ed1
parent24ccacfafd8aa0bcb152cc666554c189373c13aa (diff)
* process.c (rb_f_system): use rb_pid_t for pid.
(rb_spawn_internal): local variable renamed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--process.c25
2 files changed, 18 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 06756638dcc..eeb4853cd47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Mar 14 14:45:51 2009 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_f_system): use rb_pid_t for pid.
+ (rb_spawn_internal): local variable renamed.
+
Sat Mar 14 14:16:02 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* util.c (ruby_strdup, Balloc, rv_alloc): use size_t.
diff --git a/process.c b/process.c
index 0903f37f9c4..1b9380aecb5 100644
--- a/process.c
+++ b/process.c
@@ -2837,7 +2837,7 @@ static rb_pid_t
rb_spawn_internal(int argc, VALUE *argv, int default_close_others,
char *errmsg, size_t errmsg_buflen)
{
- rb_pid_t status;
+ rb_pid_t pid;
VALUE prog;
struct rb_exec_arg earg;
#if !defined HAVE_FORK
@@ -2852,7 +2852,7 @@ rb_spawn_internal(int argc, VALUE *argv, int default_close_others,
rb_exec_arg_fixup(&earg);
#if defined HAVE_FORK
- status = rb_fork_err(&status, rb_exec_atfork, &earg, earg.redirect_fds, errmsg, errmsg_buflen);
+ pid = rb_fork_err(&pid, rb_exec_atfork, &earg, earg.redirect_fds, errmsg, errmsg_buflen);
if (prog && earg.argc) earg.argv[0] = prog;
#else
if (rb_run_exec_options_err(&earg, &sarg, errmsg, errmsg_buflen) < 0) {
@@ -2864,24 +2864,24 @@ rb_spawn_internal(int argc, VALUE *argv, int default_close_others,
if (prog && argc) argv[0] = prog;
# if defined HAVE_SPAWNV
if (!argc) {
- status = proc_spawn(RSTRING_PTR(prog));
+ pid = proc_spawn(RSTRING_PTR(prog));
}
else {
- status = proc_spawn_n(argc, argv, prog);
+ pid = proc_spawn_n(argc, argv, prog);
}
# if defined(_WIN32)
- if (status == -1)
+ if (pid == -1)
rb_last_status_set(0x7f << 8, 0);
# endif
# else
if (argc) prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
- status = system(StringValuePtr(prog));
- rb_last_status_set((status & 0xff) << 8, 0);
+ pid = system(StringValuePtr(prog));
+ rb_last_status_set((pid & 0xff) << 8, 0);
# endif
rb_run_exec_options_err(&sarg, NULL, errmsg, errmsg_buflen);
#endif
- return status;
+ return pid;
}
rb_pid_t
@@ -2930,6 +2930,7 @@ rb_spawn(int argc, VALUE *argv)
static VALUE
rb_f_system(int argc, VALUE *argv)
{
+ rb_pid_t pid;
int status;
#if defined(SIGCLD) && !defined(SIGCHLD)
@@ -2941,16 +2942,16 @@ rb_f_system(int argc, VALUE *argv)
chfunc = signal(SIGCHLD, SIG_DFL);
#endif
- status = rb_spawn_internal(argc, argv, Qfalse, NULL, 0);
+ pid = rb_spawn_internal(argc, argv, Qfalse, NULL, 0);
#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
- if (status > 0) {
- rb_syswait(status);
+ if (pid > 0) {
+ rb_syswait(pid);
}
#endif
#ifdef SIGCHLD
signal(SIGCHLD, chfunc);
#endif
- if (status < 0) {
+ if (pid < 0) {
return Qnil;
}
status = PST2INT(rb_last_status_get());