From 40ae2e01084849672cc14feae3086526a85ac70e Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 23 Jun 2012 01:43:51 +0000 Subject: [PATCH] * internal.h (rb_execarg): add unsetenv_others_given and unsetenv_others_do fields. * process.c (EXEC_OPTION_UNSETENV_OTHERS): removed. (rb_execarg_addopt): update the new fields, instead of options array. (rb_execarg_fixup): use the new fields. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++++ internal.h | 2 ++ process.c | 16 ++++++++-------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 281eeb1ab2..4d1e61a23e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sat Jun 23 10:41:59 2012 Tanaka Akira + + * internal.h (rb_execarg): add unsetenv_others_given and + unsetenv_others_do fields. + + * process.c (EXEC_OPTION_UNSETENV_OTHERS): removed. + (rb_execarg_addopt): update the new fields, instead of options array. + (rb_execarg_fixup): use the new fields. + Sat Jun 23 09:35:47 2012 Tanaka Akira * process.c: use the variable name "soptions" for sargp->options. diff --git a/internal.h b/internal.h index 3d7a68c95b..945599e699 100644 --- a/internal.h +++ b/internal.h @@ -178,6 +178,8 @@ struct rb_execarg { VALUE dup2_tmpbuf; unsigned pgroup_given : 1; unsigned umask_given : 1; + unsigned unsetenv_others_given : 1; + unsigned unsetenv_others_do : 1; pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0unsetenv_others_given) { rb_raise(rb_eArgError, "unsetenv_others option specified twice"); } - val = RTEST(val) ? Qtrue : Qfalse; - rb_ary_store(options, EXEC_OPTION_UNSETENV_OTHERS, val); + eargp->unsetenv_others_given = 1; + eargp->unsetenv_others_do = RTEST(val) ? 1 : 0; } else if (id == rb_intern("chdir")) { if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_CHDIR))) { @@ -2116,7 +2115,8 @@ void rb_execarg_fixup(VALUE execarg_obj) { struct rb_execarg *eargp = rb_execarg_get(execarg_obj); - VALUE unsetenv_others, envopts; + int unsetenv_others; + VALUE envopts; VALUE ary; eargp->redirect_fds = check_exec_fds(eargp->options); @@ -2129,12 +2129,12 @@ rb_execarg_fixup(VALUE execarg_obj) eargp->dup2_tmpbuf = tmpbuf; } - unsetenv_others = rb_ary_entry(eargp->options, EXEC_OPTION_UNSETENV_OTHERS); + unsetenv_others = eargp->unsetenv_others_given && eargp->unsetenv_others_do; envopts = rb_ary_entry(eargp->options, EXEC_OPTION_ENV); - if (RTEST(unsetenv_others) || !NIL_P(envopts)) { + if (unsetenv_others || !NIL_P(envopts)) { VALUE envtbl, envp_str, envp_buf; char *p, *ep; - if (RTEST(unsetenv_others)) { + if (unsetenv_others) { envtbl = rb_hash_new(); } else {