Handle failure of listen better

This commit is contained in:
Jamie Cameron
2012-03-01 21:48:23 -08:00
parent 1180adcea5
commit ee9aed0b99

View File

@ -54,7 +54,7 @@ untie(*STDOUT);
# Accept the TCP connection
$acptaddr = accept(SOCK, MAIN);
die "accept failed!" if (!$acptaddr);
die "accept failed : $!" if (!$acptaddr);
$oldsel = select(SOCK);
$| = 1;
select($oldsel);
@ -307,7 +307,7 @@ while(1) {
$$port++;
last if (bind($fh, sockaddr_in($$port, INADDR_ANY)));
}
listen($fh, SOMAXCONN);
listen($fh, SOMAXCONN) || return "listed failed : $!";
return undef;
}