actually check that read may return zero on EOF
authorreidrac <jjm@usebox.net>
Sat, 26 Jan 2013 13:22:36 +0000 (13:22 +0000)
committerreidrac <jjm@usebox.net>
Sat, 26 Jan 2013 13:22:36 +0000 (13:22 +0000)
nbd-client.c

index 49f75eded4ee3f7ef4113aeefe9928dc58346e30..1445621ba552b1e4fa915aff2b7aa07b1db93721 100644 (file)
@@ -283,7 +283,7 @@ void negotiate(int sock, u64 *rsize64, u32 *flags, char* name, uint32_t needed_f
                printf(".");
        }
 
-       if (read(sock, &size64, sizeof(size64)) < 0) {
+       if (read(sock, &size64, sizeof(size64)) <= 0) {
                if (!errno)
                        err("Server closed connection");
                err("Failed/3: %m\n");