diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-08 04:56:07 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-08 04:56:07 +0000 |
commit | 87a77c71748c1b97e16f141709e9679f37efc441 (patch) | |
tree | 6e4b8558cb6a360e20e1f73861630c69708065b2 | |
parent | bc4088d768c081b15949d06f2dfb6b88c33e3eef (diff) | |
download | ruby-87a77c71748c1b97e16f141709e9679f37efc441.tar.gz |
* win32/win32.c (rb_w32_pipe_exec): must close original handle
before exec. fixed: [ruby-dev:25112]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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; |