From ec5e44f2c704d6e47159b5f61ec761e7b2a7a76a Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 14 Mar 2009 05:46:43 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ process.c | 25 +++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06756638dc..eeb4853cd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Mar 14 14:45:51 2009 Tanaka Akira + + * 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 * util.c (ruby_strdup, Balloc, rv_alloc): use size_t. diff --git a/process.c b/process.c index 0903f37f9c..1b9380aecb 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());