0
@@ -439,7 +439,7 @@ exit_handler(void)
0
if (NtSocketsInitialized) {
0
+
st_free_table(socklist);
0
NtSocketsInitialized = 0;
0
@@ -751,10 +751,9 @@ rb_w32_join_argv(char *cmd, char *const *argv)
0
-static int socketpair_internal(int af, int type, int protocol, SOCKET *sv);
0
-rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe, int *write_pipe)
0
+rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe,
0
struct ChildRecord* child;
0
@@ -762,7 +761,6 @@ rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe, int *wr
0
SECURITY_ATTRIBUTES sa;
0
/* Figure out what we're doing... */
0
@@ -777,7 +775,9 @@ rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe, int *wr
0
- binmode |= (mode & O_BINARY) ? O_BINARY : O_TEXT;
0
+ mode &= ~(O_RDWR|O_RDONLY|O_WRONLY);
0
+ if (!(mode & O_BINARY))
0
sa.nLength = sizeof (SECURITY_ATTRIBUTES);
0
sa.lpSecurityDescriptor = NULL;
0
@@ -837,21 +837,31 @@ rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe, int *wr
0
/* associate handle to file descritor */
0
- *pipe = rb_w32_open_osfhandle((intptr_t)hDupIn,
_O_RDONLY | binmode);
0
+ *pipe = rb_w32_open_osfhandle((intptr_t)hDupIn,
O_RDONLY | mode);
0
- *write_pipe = rb_w32_open_osfhandle((intptr_t)hDupOut, _O_WRONLY | binmode);
0
+ *write_pipe = rb_w32_open_osfhandle((intptr_t)hDupOut,
0
- *pipe = rb_w32_open_osfhandle((intptr_t)hDupOut,
_O_WRONLY | binmode);
0
+ *pipe = rb_w32_open_osfhandle((intptr_t)hDupOut,
O_WRONLY | mode);
0
+ if (reading && writing && *write_pipe == -1) {
0
+ CloseChildHandle(child);
0
+ else if (*pipe == -1) {
0
CloseChildHandle(child);
0
@@ -2272,8 +2282,11 @@ rb_w32_accept(int s, struct sockaddr *addr, int *addrlen)
0
- st_insert(socklist, (st_data_t)r, (st_data_t)0);
0
s = rb_w32_open_osfhandle(r, O_RDWR|O_BINARY|O_NOINHERIT);
0
+ st_insert(socklist, (st_data_t)r, (st_data_t)0);
0
@@ -2629,8 +2642,11 @@ rb_w32_socket(int af, int type, int protocol)
0
- st_insert(socklist, (st_data_t)s, (st_data_t)0);
0
fd = rb_w32_open_osfhandle(s, O_RDWR|O_BINARY|O_NOINHERIT);
0
+ st_insert(socklist, (st_data_t)s, (st_data_t)0);
0
@@ -2850,10 +2866,20 @@ rb_w32_socketpair(int af, int type, int protocol, int *sv)
0
if (socketpair_internal(af, type, protocol, pair) < 0)
0
- st_insert(socklist, (st_data_t)pair[0], (st_data_t)0);
0
- st_insert(socklist, (st_data_t)pair[1], (st_data_t)0);
0
sv[0] = rb_w32_open_osfhandle(pair[0], O_RDWR|O_BINARY|O_NOINHERIT);
0
sv[1] = rb_w32_open_osfhandle(pair[1], O_RDWR|O_BINARY|O_NOINHERIT);
0
+ st_insert(socklist, (st_data_t)pair[0], (st_data_t)0);
0
+ st_insert(socklist, (st_data_t)pair[1], (st_data_t)0);
Comments
No one has commented yet.