* 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
This commit is contained in:
parent
2a15a26c57
commit
40ae2e0108
@ -1,3 +1,12 @@
|
||||
Sat Jun 23 10:41:59 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* 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 <akr@fsij.org>
|
||||
|
||||
* process.c: use the variable name "soptions" for sargp->options.
|
||||
|
@ -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 (0<V). */
|
||||
mode_t umask_mask;
|
||||
};
|
||||
|
16
process.c
16
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user