зеркало из https://github.com/github/ruby.git
* 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:
Родитель
bc4088d768
Коммит
87a77c7174
|
@ -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
|
* win32/win32.c (rb_w32_pipe_exec): must close original handle
|
||||||
before closesocket(). fixed: [ruby-dev:25112]
|
before exec. fixed: [ruby-dev:25112]
|
||||||
|
|
||||||
Wed Dec 8 11:46:26 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
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,
|
&hDupFile, 0, FALSE,
|
||||||
DUPLICATE_SAME_ACCESS)) {
|
DUPLICATE_SAME_ACCESS)) {
|
||||||
errno = map_errno(GetLastError());
|
errno = map_errno(GetLastError());
|
||||||
CloseHandle((HANDLE)pair[0]);
|
closesocket(pair[0]);
|
||||||
CloseHandle((HANDLE)pair[1]);
|
closesocket(pair[1]);
|
||||||
CloseHandle(hCurProc);
|
CloseHandle(hCurProc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
closesocket(pair[1]);
|
||||||
hOrg = hIn = hOut = (HANDLE)pair[0];
|
hOrg = hIn = hOut = (HANDLE)pair[0];
|
||||||
}
|
}
|
||||||
else if (reading) {
|
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 */
|
/* associate handle to file descritor */
|
||||||
*pipe = rb_w32_open_osfhandle((long)hDupFile, pipemode);
|
*pipe = rb_w32_open_osfhandle((long)hDupFile, pipemode);
|
||||||
if (!(reading && writing))
|
|
||||||
CloseHandle(hOrg);
|
|
||||||
if (*pipe == -1) {
|
if (*pipe == -1) {
|
||||||
|
CloseHandle(hOrg);
|
||||||
CloseHandle(hDupFile);
|
CloseHandle(hDupFile);
|
||||||
CloseChildHandle(child);
|
CloseChildHandle(child);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!(reading && writing))
|
||||||
|
CloseHandle(hOrg);
|
||||||
|
|
||||||
ret = child->pid;
|
ret = child->pid;
|
||||||
} while (0));
|
} while (0));
|
||||||
|
@ -3405,8 +3407,6 @@ rb_w32_fclose(FILE *fp)
|
||||||
}
|
}
|
||||||
_set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
|
_set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
shutdown(sock, 0);
|
|
||||||
shutdown(sock, 1);
|
|
||||||
if (closesocket(sock) == SOCKET_ERROR) {
|
if (closesocket(sock) == SOCKET_ERROR) {
|
||||||
errno = map_errno(WSAGetLastError());
|
errno = map_errno(WSAGetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3423,8 +3423,6 @@ rb_w32_close(int fd)
|
||||||
UnlockFile((HANDLE)sock, 0, 0, LK_LEN, LK_LEN);
|
UnlockFile((HANDLE)sock, 0, 0, LK_LEN, LK_LEN);
|
||||||
return _close(fd);
|
return _close(fd);
|
||||||
}
|
}
|
||||||
shutdown(sock, 0);
|
|
||||||
shutdown(sock, 1);
|
|
||||||
if (closesocket(sock) == SOCKET_ERROR) {
|
if (closesocket(sock) == SOCKET_ERROR) {
|
||||||
errno = map_errno(WSAGetLastError());
|
errno = map_errno(WSAGetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче