summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-26 14:15:49 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-26 14:15:49 +0000
commite5f2b421c0b5134a58a4cf45234f54c376fd1297 (patch)
tree7676dfcfd62aa77f8b3ca1b885d4183b4adcda13 /io.c
parent6fa7d6cb014334082f020e57c248de6ea4a30b94 (diff)
* ext/socket/socket.c (sock_accept): revert to avoid ambiguity of
argument evaluation order. [ruby-dev:28861] * ext/socket/socket.c (sock_accept_nonblock): ditto. * io.c (pipe_open): avoid closing uninitialized file descriptors. a patch from <tommy at tmtm.org> [ruby-dev:28600] * parse.y: replace terminal token names with more descriptive name, i.e. kEND to keyword_end. [ruby-list:42477] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/io.c b/io.c
index e8007819b2..8927fad927 100644
--- a/io.c
+++ b/io.c
@@ -3029,8 +3029,14 @@ pipe_open(int argc, VALUE *argv, const char *mode)
/* parent */
if (pid == -1) {
int e = errno;
- close(arg.pair[0]);
- close(arg.pair[1]);
+ if ((modef & FMODE_READABLE)) {
+ close(arg.pair[0]);
+ close(arg.pair[1]);
+ }
+ if ((modef & FMODE_WRITABLE)) {
+ close(arg.pair[0]);
+ close(arg.pair[1]);
+ }
errno = e;
rb_sys_fail(cmd);
}