diff options
| author | Linus Nordberg <linus@nordu.net> | 2011-03-03 16:05:48 +0100 | 
|---|---|---|
| committer | Linus Nordberg <linus@nordu.net> | 2011-03-03 16:05:48 +0100 | 
| commit | 41a69151d5a375f524e2227f87979ff758bf2a62 (patch) | |
| tree | 88ecbacb8131b14c1e9a4a3503179a618c0204ce | |
| parent | b01fafad7778040ec98619653328deecc1ef1ab1 (diff) | |
_init_evb: Don't crash on socket errors.
| -rw-r--r-- | lib/compat.c | 8 | ||||
| -rw-r--r-- | lib/compat.h | 1 | ||||
| -rw-r--r-- | lib/packet.c | 6 | 
3 files changed, 13 insertions, 2 deletions
diff --git a/lib/compat.c b/lib/compat.c new file mode 100644 index 0000000..731c071 --- /dev/null +++ b/lib/compat.c @@ -0,0 +1,8 @@ +#include <sys/types.h> +#include <sys/socket.h> + +ssize_t +compat_send (int sockfd, const void *buf, size_t len, int flags) +{ +  compat_send (int sockfd, const void *buf, size_t len, int flags); +} diff --git a/lib/compat.h b/lib/compat.h new file mode 100644 index 0000000..202d6dd --- /dev/null +++ b/lib/compat.h @@ -0,0 +1 @@ +ssize_t compat_send (int sockfd, const void *buf, size_t len, int flags); diff --git a/lib/packet.c b/lib/packet.c index 2ef7e45..d025027 100644 --- a/lib/packet.c +++ b/lib/packet.c @@ -404,13 +404,15 @@ _init_socket (struct rs_connection *conn, struct rs_peer *p)  		     p->addr->ai_protocol);    if (conn->fd < 0)      return rs_err_conn_push_fl (conn, RSE_SOCKERR, __FILE__, __LINE__, -				strerror (errno)); +				"socket: %d (%s)", +				errno, strerror (errno));    if (evutil_make_socket_nonblocking (conn->fd) < 0)      {        evutil_closesocket (conn->fd);        conn->fd = -1;        return rs_err_conn_push_fl (conn, RSE_SOCKERR, __FILE__, __LINE__, -				  strerror (errno)); +				  "evutil_make_socket_nonblocking: %d (%s)", +				  errno, strerror (errno));      }    return RSE_OK;  }  | 
