Project

General

Profile

Backport #1567 » ruby-1.9.1-p129-socket_listen_2.patch

Catch listen(2) failures and clean up after them - pilcrow (Mike Pomraning), 06/05/2009 11:26 AM

View differences:

ruby-1.9.1-p129/ext/socket/socket.c 2009-06-04 21:04:48.000000000 -0500
} else
break;
}
if (status >= 0 && type == INET_SERVER) {
status = listen(fd, 5);
syscall = "listen(2)";
}
if (status < 0) {
close(fd);
rb_sys_fail(syscall);
}
arg->fd = -1;
if (type == INET_SERVER)
listen(fd, 5);
/* create new instance */
return init_sock(arg->sock, fd);
}
......
rb_sys_fail(sockaddr.sun_path);
}
if (server) listen(fd, 5);
if (server) {
if (listen(fd, 5) < 0) {
close(fd);
rb_sys_fail("listen(2)");
}
}
init_sock(sock, fd);
if (server) {
(2-2/2)