]> git.tue.mpg.de Git - paraslash.git/commitdiff
Fix return value of dccp_recv pre_select()
authorAndre <maan@p133.(none)>
Thu, 23 Mar 2006 14:01:08 +0000 (15:01 +0100)
committerAndre <maan@p133.(none)>
Thu, 23 Mar 2006 14:01:08 +0000 (15:01 +0100)
Also, add a log message on errors/eof.

dccp_recv.c

index 95d2ba8a8a2447a2cfaa1dc8a003b081538628f5..168ddf4f18ba3e91ebdd290eeddbdb51b08930d2 100644 (file)
@@ -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;
 }