summaryrefslogtreecommitdiff
path: root/ext/pty
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pty')
-rw-r--r--ext/pty/pty.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 182ad18..9e5aff9 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -78,7 +78,8 @@ static void getDevice(int*, int*, char [DEVICELEN], int);
struct child_info {
int master, slave;
char *slavename;
- struct rb_exec_arg earg;
+ VALUE execarg_obj;
+ struct rb_exec_arg *earg;
};
static int
@@ -142,7 +143,7 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
seteuid(getuid());
#endif
- return rb_exec_async_signal_safe(&carg->earg, errbuf, sizeof(errbuf_len));
+ return rb_exec_async_signal_safe(carg->earg, errbuf, sizeof(errbuf_len));
#undef ERROR_EXIT
}
@@ -176,8 +177,9 @@ establishShell(int argc, VALUE *argv, struct pty_info *info,
argv = &v;
}
- rb_execarg_init(argc, argv, 1, &carg.earg);
- rb_execarg_fixup(&carg.earg);
+ carg.execarg_obj = rb_execarg_new(argc, argv, 1);
+ carg.earg = rb_execarg_get(carg.execarg_obj);
+ rb_execarg_fixup(carg.earg);
getDevice(&master, &slave, SlaveName, 0);
@@ -200,6 +202,8 @@ establishShell(int argc, VALUE *argv, struct pty_info *info,
info->child_pid = pid;
info->fd = master;
+
+ RB_GC_GUARD(carg.execarg_obj);
}
static int