From: Andre Date: Thu, 23 Mar 2006 14:01:08 +0000 (+0100) Subject: Fix return value of dccp_recv pre_select() X-Git-Tag: v0.2.12~146 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=74a6b7e900a7ca84103000028fe7e3ab56dbbcf3;p=paraslash.git Fix return value of dccp_recv pre_select() Also, add a log message on errors/eof. --- diff --git a/dccp_recv.c b/dccp_recv.c index 95d2ba8a..168ddf4f 100644 --- a/dccp_recv.c +++ b/dccp_recv.c @@ -119,8 +119,9 @@ static int dccp_recv_pre_select(struct receiver_node *rn, fd_set *rfds, { struct private_dccp_recv_data *pdd = rn->private_data; - if (pdd) - FD_SET(pdd->fd, rfds); + if (!pdd) + return -1; + FD_SET(pdd->fd, rfds); return pdd->fd; } @@ -136,8 +137,10 @@ static int dccp_recv_post_select(struct receiver_node *rn, int select_ret, return -E_DCCP_OVERRUN; ret = recv_bin_buffer(pdd->fd, rn->buf + rn->loaded, DCCP_BUFSIZE - rn->loaded); - if (ret <= 0) + if (ret <= 0) { + PARA_INFO_LOG("%s\n", ret? PARA_STRERROR(-ret) : "eof"); return ret; + } rn->loaded += ret; return 1; }