summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--socket.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/socket.c b/socket.c
index 35ef7220..7b695573 100644
--- a/socket.c
+++ b/socket.c
@@ -1047,7 +1047,7 @@ static val socketpair_wrap(val family, val type, val mode_str)
{
val s0 = open_sockfd(num(sv[0]), family, type, mode_str);
- val s1 = open_sockfd(num(sv[1]), family, type, mode_str);
+ val s1 = open_sockfd(num(sv[1]), family, type, mode_str);
sock_mark_connected(s0);
sock_mark_connected(s1);
@@ -1056,10 +1056,12 @@ static val socketpair_wrap(val family, val type, val mode_str)
}
uw_unwind {
- if (sv[0] != -1)
- close(sv[0]);
- if (sv[1] != -1)
- close(sv[1]);
+ if (!out) {
+ if (sv[0] != -1)
+ close(sv[0]);
+ if (sv[1] != -1)
+ close(sv[1]);
+ }
}
uw_catch_end;