net.c: Return proper error value in recv_bin_buffer().
[paraslash.git] / net.c
diff --git a/net.c b/net.c
index 9a93553985516b0db7150d20af99136b33165910..c7bb8b4b71293ee89964b55175c2170fb10c3e31 100644 (file)
--- a/net.c
+++ b/net.c
@@ -6,8 +6,8 @@
 
 /** \file net.c networking-related helper functions */
 
-#include "error.h"
 #include "para.h"
+#include "error.h"
 #include "net.h"
 #include "string.h"
 
@@ -120,7 +120,7 @@ static int sendall(int fd, const char *buf, size_t *len)
                total += n;
                bytesleft -= n;
                if (total < *len)
-                       PARA_DEBUG_LOG("short write (%zd byte(s) left)",
+                       PARA_DEBUG_LOG("short write (%zd byte(s) left)\n",
                                *len - total);
        }
        *len = total; /* return number actually sent here */
@@ -232,7 +232,7 @@ __must_check int recv_bin_buffer(int fd, char *buf, size_t size)
        } else
                n = recv(fd, buf, size, 0);
        if (n == -1)
-               n = -E_RECV;
+               return -ERRNO_TO_PARA_ERROR(errno);
        return n;
 }