In bind_port(), check if the socket is valid before marking it CLOSEEXEC