diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-15 11:57:55 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-15 11:57:55 +0000 |
commit | 68e6b4ccbd668ff79a134c870d6481e8e3152313 (patch) | |
tree | ee3c82962fb2288ea2f17c93d2440709cb1ff1f6 /io.c | |
parent | ea610ae04642f8a62eea5c3d4c31a6a956c77fce (diff) |
merges r24090 from trunk into ruby_1_9_1.
--
* io.c (pipe_open): handles leaked on win32 when an error occurs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@24120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -4650,9 +4650,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; } } |