summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/io.c b/io.c
index a475495677..bf64f14292 100644
--- a/io.c
+++ b/io.c
@@ -5726,9 +5726,13 @@ pipe_open(struct rb_exec_arg *eargp, const char *modestr, int fmode, convconfig_
static VALUE
pipe_open_v(int argc, VALUE *argv, const char *modestr, int fmode, convconfig_t *convconfig)
{
- struct rb_exec_arg earg;
- rb_execarg_init(argc, argv, FALSE, &earg);
- return pipe_open(&earg, modestr, fmode, convconfig);
+ VALUE execarg_obj, ret;
+ struct rb_exec_arg *earg;
+ execarg_obj = rb_execarg_new(argc, argv, FALSE);
+ earg = rb_execarg_get(execarg_obj);
+ ret = pipe_open(earg, modestr, fmode, convconfig);
+ RB_GC_GUARD(execarg_obj);
+ return ret;
}
static VALUE
@@ -5737,7 +5741,8 @@ pipe_open_s(VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig
const char *cmd = RSTRING_PTR(prog);
int argc = 1;
VALUE *argv = &prog;
- struct rb_exec_arg earg;
+ VALUE execarg_obj, ret;
+ struct rb_exec_arg *earg;
if (RSTRING_LEN(prog) == 1 && cmd[0] == '-') {
#if !defined(HAVE_FORK)
@@ -5747,8 +5752,11 @@ pipe_open_s(VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig
return pipe_open(NULL, modestr, fmode, convconfig);
}
- rb_execarg_init(argc, argv, TRUE, &earg);
- return pipe_open(&earg, modestr, fmode, convconfig);
+ execarg_obj = rb_execarg_new(argc, argv, TRUE);
+ earg = rb_execarg_get(execarg_obj);
+ ret = pipe_open(earg, modestr, fmode, convconfig);
+ RB_GC_GUARD(execarg_obj);
+ return ret;
}
/*