* 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
@ -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>
|
Tue Apr 10 16:14:22 2007 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* thread_win32.ci (w32_wait_events): check whether interrupt_event is
|
* thread_win32.ci (w32_wait_events): check whether interrupt_event is
|
||||||
|
@ -3944,6 +3944,7 @@ rb_w32_fclose(FILE *fp)
|
|||||||
{
|
{
|
||||||
int fd = fileno(fp);
|
int fd = fileno(fp);
|
||||||
SOCKET sock = TO_SOCKET(fd);
|
SOCKET sock = TO_SOCKET(fd);
|
||||||
|
int save_errno = errno;
|
||||||
|
|
||||||
if (fflush(fp)) return -1;
|
if (fflush(fp)) return -1;
|
||||||
if (!is_socket(sock)) {
|
if (!is_socket(sock)) {
|
||||||
@ -3952,6 +3953,7 @@ rb_w32_fclose(FILE *fp)
|
|||||||
}
|
}
|
||||||
_set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
|
_set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
errno = save_errno;
|
||||||
if (closesocket(sock) == SOCKET_ERROR) {
|
if (closesocket(sock) == SOCKET_ERROR) {
|
||||||
errno = map_errno(WSAGetLastError());
|
errno = map_errno(WSAGetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
@ -3963,6 +3965,7 @@ int
|
|||||||
rb_w32_close(int fd)
|
rb_w32_close(int fd)
|
||||||
{
|
{
|
||||||
SOCKET sock = TO_SOCKET(fd);
|
SOCKET sock = TO_SOCKET(fd);
|
||||||
|
int save_errno = errno;
|
||||||
|
|
||||||
if (!is_socket(sock)) {
|
if (!is_socket(sock)) {
|
||||||
UnlockFile((HANDLE)sock, 0, 0, LK_LEN, LK_LEN);
|
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);
|
_set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
|
||||||
_close(fd);
|
_close(fd);
|
||||||
|
errno = save_errno;
|
||||||
if (closesocket(sock) == SOCKET_ERROR) {
|
if (closesocket(sock) == SOCKET_ERROR) {
|
||||||
errno = map_errno(WSAGetLastError());
|
errno = map_errno(WSAGetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user