* 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
This commit is contained in:
usa 2004-12-08 04:56:07 +00:00
Родитель bc4088d768
Коммит 87a77c7174
2 изменённых файлов: 9 добавлений и 11 удалений

Просмотреть файл

@ -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>

Просмотреть файл

@ -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;