From 9ce7c81abb4683595c709c17a34bf1809191e91f Mon Sep 17 00:00:00 2001 From: shyouhei Date: Tue, 22 May 2007 17:01:04 +0000 Subject: merge -r 12165:12168 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@12318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'win32/win32.c') diff --git a/win32/win32.c b/win32/win32.c index d63e3ab172..1ca2ee41ed 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3613,6 +3613,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)) { @@ -3621,6 +3622,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; @@ -3632,6 +3634,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); @@ -3639,6 +3642,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; -- cgit v1.2.3