aboutsummaryrefslogtreecommitdiffstats
path: root/src/sctp_m2ua.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-26 11:02:42 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-26 11:02:42 +0100
commitc5562bde48571ce4fa5a8edf8c1ae2e6f6a5ff6b (patch)
treec081843429292a488b54b67c70470ae013c4e298 /src/sctp_m2ua.c
parent44f848b086d9143a53d3209df5820f801036420f (diff)
sctp: Close the socket if we get <= 0 as a result for sctp_rcvmsg
The manpage says that -1 is the indication for error but on 2.6.12 we just ended up in a infinite loop as select shows the socket as readable but a recvmsg does not give any data.
Diffstat (limited to 'src/sctp_m2ua.c')
-rw-r--r--src/sctp_m2ua.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sctp_m2ua.c b/src/sctp_m2ua.c
index 5d1db25..83784ec 100644
--- a/src/sctp_m2ua.c
+++ b/src/sctp_m2ua.c
@@ -429,7 +429,7 @@ static int m2ua_conn_read(struct bsc_fd *fd)
memset(&addr, 0, sizeof(addr));
rc = sctp_recvmsg(fd->fd, msg->data, msg->data_len,
(struct sockaddr *) &addr, &len, &info, NULL);
- if (rc < 0) {
+ if (rc <= 0) {
LOGP(DINP, LOGL_ERROR, "Failed to read.\n");
m2ua_conn_destroy(fd->data);
return -1;