* 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: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ocean 2005-01-06 11:05:31 +00:00
parent 992cd33d1a
commit 02ee8870d6
2 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,10 @@
Thu Jan 6 19:55:13 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* 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.
Thu Jan 6 17:14:31 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp> Thu Jan 6 17:14:31 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* random.c (random_seed): O_NONBLOCK isn't defined on some * random.c (random_seed): O_NONBLOCK isn't defined on some

View file

@ -93,7 +93,7 @@ static struct ChildRecord *CreateChild(const char *, const char *, SECURITY_ATTR
static bool has_redirection(const char *); static bool has_redirection(const char *);
static void StartSockets (); static void StartSockets ();
static DWORD wait_events(HANDLE event, DWORD timeout); 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); static int rb_w32_open_osfhandle(long osfhandle, int flags);
#else #else
#define rb_w32_open_osfhandle(osfhandle, flags) _open_osfhandle(osfhandle, flags) #define rb_w32_open_osfhandle(osfhandle, flags) _open_osfhandle(osfhandle, flags)
@ -1637,6 +1637,19 @@ rb_w32_open_osfhandle(long osfhandle, int flags)
#endif #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 #undef getsockopt
static int static int
@ -3231,6 +3244,7 @@ rb_w32_close(int fd)
return _close(fd); return _close(fd);
} }
_set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE); _set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
_close(fd);
if (closesocket(sock) == SOCKET_ERROR) { if (closesocket(sock) == SOCKET_ERROR) {
errno = map_errno(WSAGetLastError()); errno = map_errno(WSAGetLastError());
return -1; return -1;