diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | win32/win32.c | 14 |
2 files changed, 9 insertions, 11 deletions
@@ -1,7 +1,7 @@ -Wed Dec 8 11:52:51 2004 NAKAMURA Usaku <usa@ruby-lang.org> +Wed Dec 8 13:49:46 2004 NAKAMURA Usaku <usa@ruby-lang.org> - * win32/win32.c (rb_w32_fclose, rb_w32_close): shutdown socket - before closesocket(). fixed: [ruby-dev:25112] + * win32/win32.c (rb_w32_pipe_exec): must close original handle + before exec. fixed: [ruby-dev:25112] Wed Dec 8 11:46:26 2004 Nobuyoshi Nakada <nobu@ruby-lang.org> diff --git a/win32/win32.c b/win32/win32.c index 0808e49d1b..4cb1d45dc7 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -724,11 +724,12 @@ rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe) &hDupFile, 0, FALSE, DUPLICATE_SAME_ACCESS)) { errno = map_errno(GetLastError()); - CloseHandle((HANDLE)pair[0]); - CloseHandle((HANDLE)pair[1]); + closesocket(pair[0]); + closesocket(pair[1]); CloseHandle(hCurProc); break; } + closesocket(pair[1]); hOrg = hIn = hOut = (HANDLE)pair[0]; } else if (reading) { @@ -779,13 +780,14 @@ rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe) /* associate handle to file descritor */ *pipe = rb_w32_open_osfhandle((long)hDupFile, pipemode); - if (!(reading && writing)) - CloseHandle(hOrg); if (*pipe == -1) { + CloseHandle(hOrg); CloseHandle(hDupFile); CloseChildHandle(child); break; } + if (!(reading && writing)) + CloseHandle(hOrg); ret = child->pid; } while (0)); @@ -3405,8 +3407,6 @@ rb_w32_fclose(FILE *fp) } _set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE); fclose(fp); - shutdown(sock, 0); - shutdown(sock, 1); if (closesocket(sock) == SOCKET_ERROR) { errno = map_errno(WSAGetLastError()); return -1; @@ -3423,8 +3423,6 @@ rb_w32_close(int fd) UnlockFile((HANDLE)sock, 0, 0, LK_LEN, LK_LEN); return _close(fd); } - shutdown(sock, 0); - shutdown(sock, 1); if (closesocket(sock) == SOCKET_ERROR) { errno = map_errno(WSAGetLastError()); return -1; |