diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-26 07:23:47 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-26 07:23:47 +0000 |
| commit | 64cca618ce0e26b035db6bb023edaaee01daf32c (patch) | |
| tree | 676392b6e65a3a36e14390fc60244aa1e3d5caea | |
| parent | 5e68db6f123353166291d805f0c6508c05627714 (diff) | |
| download | ruby-64cca618ce0e26b035db6bb023edaaee01daf32c.tar.gz ruby-64cca618ce0e26b035db6bb023edaaee01daf32c.tar.xz ruby-64cca618ce0e26b035db6bb023edaaee01daf32c.zip | |
* io.c (pipe_open): avoid closing uninitialized file descriptors.
a patch from <tommy at tmtm.org> [ruby-dev:28600]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | io.c | 15 |
2 files changed, 18 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Mon Jun 26 10:47:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org> + + * io.c (pipe_open): avoid closing uninitialized file descriptors. + a patch from <tommy at tmtm.org> [ruby-dev:28600] + Mon Jun 26 09:56:22 2006 NAKAMURA Usaku <usa@ruby-lang.org> * win32/win32.[ch] (rb_w32_send, rb_w32_sendto): constified. @@ -3136,8 +3136,19 @@ retry: rb_thread_sleep(1); goto retry; } - close(pr[0]); close(pw[1]); - rb_sys_fail(pname); + else { + int e = errno; + if ((modef & FMODE_READABLE)) { + close(pr[0]); + close(pr[1]); + } + if ((modef & FMODE_WRITABLE)) { + close(pw[0]); + close(pw[1]); + } + errno = e; + rb_sys_fail(pname); + } break; default: /* parent */ |
