mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (popen_exec), process.c (rb_spawn): stop other threads before
exec. [ruby-core:08262] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ee9e5a6ea8
commit
bf6575ef62
4 changed files with 23 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Sep 20 17:28:00 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (popen_exec), process.c (rb_spawn): stop other threads before
|
||||||
|
exec. [ruby-core:08262]
|
||||||
|
|
||||||
Tue Sep 18 22:08:42 2007 Keiju Ishitsuka <keiju@ruby-lang.org>
|
Tue Sep 18 22:08:42 2007 Keiju Ishitsuka <keiju@ruby-lang.org>
|
||||||
|
|
||||||
* lib/matrix.rb: fix a coerce bug of Vector. [ruby-core: 12190]
|
* lib/matrix.rb: fix a coerce bug of Vector. [ruby-core: 12190]
|
||||||
|
|
1
io.c
1
io.c
|
@ -3110,6 +3110,7 @@ popen_exec(void *pp)
|
||||||
struct popen_arg *p = (struct popen_arg*)pp;
|
struct popen_arg *p = (struct popen_arg*)pp;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
rb_thread_atfork();
|
||||||
popen_redirect(p);
|
popen_redirect(p);
|
||||||
for (fd = 3; fd < NOFILE; fd++) {
|
for (fd = 3; fd < NOFILE; fd++) {
|
||||||
#ifdef FD_CLOEXEC
|
#ifdef FD_CLOEXEC
|
||||||
|
|
18
process.c
18
process.c
|
@ -163,7 +163,7 @@ get_pid(void)
|
||||||
static VALUE
|
static VALUE
|
||||||
get_ppid(void)
|
get_ppid(void)
|
||||||
{
|
{
|
||||||
rb_secure(2);
|
rb_secure(2);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return INT2FIX(0);
|
return INT2FIX(0);
|
||||||
#else
|
#else
|
||||||
|
@ -959,7 +959,6 @@ proc_exec_v(char **argv, const char *prog)
|
||||||
{
|
{
|
||||||
if (!prog)
|
if (!prog)
|
||||||
prog = argv[0];
|
prog = argv[0];
|
||||||
security(prog);
|
|
||||||
prog = dln_find_exe(prog, 0);
|
prog = dln_find_exe(prog, 0);
|
||||||
if (!prog) {
|
if (!prog) {
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
|
@ -1202,6 +1201,7 @@ rb_check_argv(int argc, VALUE *argv)
|
||||||
{
|
{
|
||||||
VALUE tmp, prog;
|
VALUE tmp, prog;
|
||||||
int i;
|
int i;
|
||||||
|
const char *name = 0;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
rb_raise(rb_eArgError, "wrong number of arguments");
|
rb_raise(rb_eArgError, "wrong number of arguments");
|
||||||
|
@ -1217,12 +1217,15 @@ rb_check_argv(int argc, VALUE *argv)
|
||||||
argv[0] = RARRAY_PTR(tmp)[1];
|
argv[0] = RARRAY_PTR(tmp)[1];
|
||||||
SafeStringValue(prog);
|
SafeStringValue(prog);
|
||||||
StringValueCStr(prog);
|
StringValueCStr(prog);
|
||||||
|
prog = rb_str_new4(prog);
|
||||||
|
name = RSTRING_PTR(prog);
|
||||||
}
|
}
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
SafeStringValue(argv[i]);
|
SafeStringValue(argv[i]);
|
||||||
|
argv[i] = rb_str_new4(argv[i]);
|
||||||
StringValueCStr(argv[i]);
|
StringValueCStr(argv[i]);
|
||||||
}
|
}
|
||||||
security(RSTRING_PTR(prog ? prog : argv[0]));
|
security(name ? name : RSTRING_PTR(argv[0]));
|
||||||
return prog;
|
return prog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1298,6 +1301,13 @@ rb_exec(const struct rb_exec_arg *e)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
rb_exec_atfork(void* arg)
|
||||||
|
{
|
||||||
|
rb_thread_atfork();
|
||||||
|
return rb_exec(arg);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_FORK
|
||||||
#ifdef FD_CLOEXEC
|
#ifdef FD_CLOEXEC
|
||||||
#if SIZEOF_INT == SIZEOF_LONG
|
#if SIZEOF_INT == SIZEOF_LONG
|
||||||
|
@ -1708,7 +1718,7 @@ rb_spawn(int argc, VALUE *argv)
|
||||||
earg.argc = argc;
|
earg.argc = argc;
|
||||||
earg.argv = argv;
|
earg.argv = argv;
|
||||||
earg.prog = prog ? RSTRING_PTR(prog) : 0;
|
earg.prog = prog ? RSTRING_PTR(prog) : 0;
|
||||||
status = rb_fork(&status, (int (*)(void*))rb_exec, &earg);
|
status = rb_fork(&status, rb_exec_atfork, &earg);
|
||||||
if (prog && argc) argv[0] = prog;
|
if (prog && argc) argv[0] = prog;
|
||||||
}
|
}
|
||||||
#elif defined HAVE_SPAWNV
|
#elif defined HAVE_SPAWNV
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define RUBY_VERSION "1.9.0"
|
#define RUBY_VERSION "1.9.0"
|
||||||
#define RUBY_RELEASE_DATE "2007-09-15"
|
#define RUBY_RELEASE_DATE "2007-09-20"
|
||||||
#define RUBY_VERSION_CODE 190
|
#define RUBY_VERSION_CODE 190
|
||||||
#define RUBY_RELEASE_CODE 20070915
|
#define RUBY_RELEASE_CODE 20070920
|
||||||
#define RUBY_PATCHLEVEL 0
|
#define RUBY_PATCHLEVEL 0
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_YEAR 2007
|
#define RUBY_RELEASE_YEAR 2007
|
||||||
#define RUBY_RELEASE_MONTH 9
|
#define RUBY_RELEASE_MONTH 9
|
||||||
#define RUBY_RELEASE_DAY 15
|
#define RUBY_RELEASE_DAY 20
|
||||||
|
|
||||||
#ifdef RUBY_EXTERN
|
#ifdef RUBY_EXTERN
|
||||||
RUBY_EXTERN const char ruby_version[];
|
RUBY_EXTERN const char ruby_version[];
|
||||||
|
|
Loading…
Reference in a new issue