mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (rb_w32_fclose, rb_w32_close): need to save errno
before calling original fclose()/close(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
00f60d0748
commit
20e961458e
2 changed files with 9 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Apr 10 17:02:17 2007 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (rb_w32_fclose, rb_w32_close): need to save errno
|
||||
before calling original fclose()/close().
|
||||
|
||||
Tue Apr 10 16:14:22 2007 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* thread_win32.ci (w32_wait_events): check whether interrupt_event is
|
||||
|
|
|
@ -3944,6 +3944,7 @@ rb_w32_fclose(FILE *fp)
|
|||
{
|
||||
int fd = fileno(fp);
|
||||
SOCKET sock = TO_SOCKET(fd);
|
||||
int save_errno = errno;
|
||||
|
||||
if (fflush(fp)) return -1;
|
||||
if (!is_socket(sock)) {
|
||||
|
@ -3952,6 +3953,7 @@ rb_w32_fclose(FILE *fp)
|
|||
}
|
||||
_set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
|
||||
fclose(fp);
|
||||
errno = save_errno;
|
||||
if (closesocket(sock) == SOCKET_ERROR) {
|
||||
errno = map_errno(WSAGetLastError());
|
||||
return -1;
|
||||
|
@ -3963,6 +3965,7 @@ int
|
|||
rb_w32_close(int fd)
|
||||
{
|
||||
SOCKET sock = TO_SOCKET(fd);
|
||||
int save_errno = errno;
|
||||
|
||||
if (!is_socket(sock)) {
|
||||
UnlockFile((HANDLE)sock, 0, 0, LK_LEN, LK_LEN);
|
||||
|
@ -3970,6 +3973,7 @@ rb_w32_close(int fd)
|
|||
}
|
||||
_set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
|
||||
_close(fd);
|
||||
errno = save_errno;
|
||||
if (closesocket(sock) == SOCKET_ERROR) {
|
||||
errno = map_errno(WSAGetLastError());
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Reference in a new issue