[dbench @ cvs-1:tridge-20020311115727-tlkt4r7bbrguhcr0]
authortridge <tridge@blu>
Mon, 11 Mar 2002 11:57:27 +0000 (11:57 +0000)
committertridge <tridge@blu>
Mon, 11 Mar 2002 11:57:27 +0000 (11:57 +0000)
print a errno on recv/send failure

socklib.c

index d4e73f4abdff4ac3964fad88e235b2ba5b54d26e..a7917dd82de5e06d7319fc53b62c16d9a823ff1b 100644 (file)
--- a/socklib.c
+++ b/socklib.c
@@ -196,7 +196,10 @@ int read_sock(int s, char *buf, int size)
 
        while (size) {
                int r = recv(s, buf, size, MSG_WAITALL);
-               if (r <= 0) break;
+               if (r <= 0) {
+                       if (r == -1) perror("recv");
+                       break;
+               }
                buf += r;
                size -= r;
                total += r;
@@ -210,7 +213,10 @@ int write_sock(int s, char *buf, int size)
 
        while (size) {
                int r = send(s, buf, size, 0);
-               if (r <= 0) break;
+               if (r <= 0) {
+                       if (r == -1) perror("send");
+                       break;
+               }
                buf += r;
                size -= r;
                total += r;