diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-13 13:33:00 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-13 13:33:00 +0000 |
commit | aca5106342b1dfbe02e603e5b89a35f317a67289 (patch) | |
tree | e11848d24f12c7e9043d2b6d2afcb2c511a98d4b /io.c | |
parent | 7e40f30b60661727ffe4efb6db356f3bd44873ba (diff) | |
download | ruby-aca5106342b1dfbe02e603e5b89a35f317a67289.tar.gz ruby-aca5106342b1dfbe02e603e5b89a35f317a67289.tar.xz ruby-aca5106342b1dfbe02e603e5b89a35f317a67289.zip |
* io.c (pipe_open): handles leaked on win32 when an error occurs.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -5034,9 +5034,19 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode, rb_thread_sleep(1); break; default: - if (eargp) - rb_run_exec_options(&sarg, NULL); - rb_sys_fail(cmd); + { + int e = errno; + if (eargp) + rb_run_exec_options(&sarg, NULL); + close(pair[0]); + close(pair[1]); + if ((fmode & (FMODE_READABLE|FMODE_WRITABLE)) == (FMODE_READABLE|FMODE_WRITABLE)) { + close(write_pair[0]); + close(write_pair[1]); + } + errno = e; + rb_sys_fail(cmd); + } break; } } |