summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-23 01:43:51 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-23 01:43:51 +0000
commit40ae2e01084849672cc14feae3086526a85ac70e (patch)
tree7abb756ef35b37dfad30aeeb7d60733bde8b1262 /process.c
parent2a15a26c57faf4852a3f9b0afaafa886a78e7c96 (diff)
* 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
Diffstat (limited to 'process.c')
-rw-r--r--process.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/process.c b/process.c
index 450e3d3577..f13bee8c07 100644
--- a/process.c
+++ b/process.c
@@ -1255,7 +1255,6 @@ rb_proc_exec(const char *str)
enum {
EXEC_OPTION_RLIMIT,
- EXEC_OPTION_UNSETENV_OTHERS,
EXEC_OPTION_ENV,
EXEC_OPTION_CHDIR,
EXEC_OPTION_DUP2,
@@ -1617,11 +1616,11 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
else
#endif
if (id == rb_intern("unsetenv_others")) {
- if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_UNSETENV_OTHERS))) {
+ if (eargp->unsetenv_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 {