mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (rb_w32_{read,write}): fix handle leaks. based on
a patch from Heesob Park in [ruby-core:28919]. [ruby-core:28833] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
98131a6da1
commit
b3a039a2cb
2 changed files with 7 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Mar 25 14:50:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (rb_w32_{read,write}): fix handle leaks. based on
|
||||
a patch from Heesob Park in [ruby-core:28919]. [ruby-core:28833]
|
||||
|
||||
Thu Mar 25 12:37:37 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||
|
||||
* NEWS: add Kernel#singleton_class.
|
||||
|
|
|
@ -4895,6 +4895,7 @@ rb_w32_read(int fd, void *buf, size_t size)
|
|||
if (!ReadFile((HANDLE)_osfhnd(fd), buf, len, &read, pol)) {
|
||||
err = GetLastError();
|
||||
if (err != ERROR_IO_PENDING) {
|
||||
if (pol) CloseHandle(ol.hEvent);
|
||||
if (err == ERROR_ACCESS_DENIED)
|
||||
errno = EBADF;
|
||||
else if (err == ERROR_BROKEN_PIPE || err == ERROR_HANDLE_EOF) {
|
||||
|
@ -5028,6 +5029,7 @@ rb_w32_write(int fd, const void *buf, size_t size)
|
|||
if (!WriteFile((HANDLE)_osfhnd(fd), buf, len, &written, pol)) {
|
||||
err = GetLastError();
|
||||
if (err != ERROR_IO_PENDING) {
|
||||
if (pol) CloseHandle(ol.hEvent);
|
||||
if (err == ERROR_ACCESS_DENIED)
|
||||
errno = EBADF;
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue