Project

General

Profile

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

Catch listen(2) failures in init_inetsock_internal and init_unixsock - pilcrow (Mike Pomraning), 06/04/2009 06:03 AM

View differences:

ruby-1.9.1-p129/ext/socket/socket.c 2009-06-03 12:14:58.000000000 -0500
} else
break;
}
if (status >= 0 && type == INET_SERVER) {
status = listen(fd, 5);
syscall = "listen(2)";
}
if (status < 0) {
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) {
(1-1/2)