summaryrefslogtreecommitdiff
path: root/ext/pty
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-02 21:40:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-02 21:40:55 +0000
commitaa5c05b8ba0c1ab9255730f8cd7acab68c0af600 (patch)
tree8746b62efedf022f2f01dfd9a60a11f232e87b54 /ext/pty
parent163b4dee96abb2bdd3c208b6dd71ade4fbe09349 (diff)
* ext/pty/pty.c (chfunc): pass through exceptions.
* io.c (rb_io_bufwrite, rb_io_bufread): added. * process.c (rb_fork_err): protect from exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/pty')
-rw-r--r--ext/pty/pty.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 156e4563c3..b2b5caa2af 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -135,18 +135,6 @@ struct pty_info {
static void getDevice(int*, int*, char [DEVICELEN], int);
-struct exec_info {
- int argc;
- VALUE *argv;
-};
-
-static VALUE
-pty_exec(VALUE v)
-{
- struct exec_info *arg = (struct exec_info *)v;
- return rb_f_exec(arg->argc, arg->argv);
-}
-
struct child_info {
int master, slave;
char *slavename;
@@ -162,10 +150,7 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
int slave = carg->slave;
int argc = carg->argc;
VALUE *argv = carg->argv;
- VALUE exc;
- struct exec_info arg;
- int status;
#define ERROR_EXIT(str) do { \
strlcpy(errbuf, str, errbuf_len); \
return -1; \
@@ -218,16 +203,7 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
seteuid(getuid());
#endif
- arg.argc = argc;
- arg.argv = argv;
- rb_protect(pty_exec, (VALUE)&arg, &status);
- sleep(1);
- errno = ENOENT; /* last resort */
- exc = rb_errinfo();
- if (!NIL_P(exc)) {
- errno = NUM2INT(rb_attr_get(exc, rb_intern("errno")));
- }
- ERROR_EXIT(StringValueCStr(argv[0]));
+ return rb_f_exec(argc, argv);
#undef ERROR_EXIT
}