diff options
| author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-06 11:05:31 +0000 |
|---|---|---|
| committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-06 11:05:31 +0000 |
| commit | f5e204ba366c11240ea4bd8e832e92af79f18502 (patch) | |
| tree | 8eafff5415e119ccf583364a1e34bf5c4288b4e6 /win32 | |
| parent | b1391247e31a4967296ce6e647456b0d63d21f7c (diff) | |
| download | ruby-f5e204ba366c11240ea4bd8e832e92af79f18502.tar.gz ruby-f5e204ba366c11240ea4bd8e832e92af79f18502.tar.xz ruby-f5e204ba366c11240ea4bd8e832e92af79f18502.zip | |
* win32/win32.c (rb_w32_close): didn't close socket handle.
* win32/win32.c (rb_w32_open_osfhandle): bcc32's _open_osfhandle
never set EMFILE.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/win32.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c index da79b438a..e8fea8072 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -88,7 +88,7 @@ static struct ChildRecord *CreateChild(const char *, const char *, SECURITY_ATTR static int has_redirection(const char *); static void StartSockets(void); static DWORD wait_events(HANDLE event, DWORD timeout); -#if !defined(__BORLANDC__) && !defined(_WIN32_WCE) +#if !defined(_WIN32_WCE) static int rb_w32_open_osfhandle(long osfhandle, int flags); #else #define rb_w32_open_osfhandle(osfhandle, flags) _open_osfhandle(osfhandle, flags) @@ -1652,6 +1652,19 @@ rb_w32_open_osfhandle(long osfhandle, int flags) #endif +#ifdef __BORLANDC__ +static int +rb_w32_open_osfhandle(long osfhandle, int flags) +{ + int fd = _open_osfhandle(osfhandle, flags); + if (fd == -1) { + errno = EMFILE; /* too many open files */ + _doserrno = 0L; /* not an OS error */ + } + return fd; +} +#endif + #undef getsockopt static int @@ -3427,6 +3440,7 @@ rb_w32_close(int fd) return _close(fd); } _set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE); + _close(fd); if (closesocket(sock) == SOCKET_ERROR) { errno = map_errno(WSAGetLastError()); return -1; |
