If the export is unknown to the server, it may disconnect (new-style handshake
un-fixed). In that case the read call to get export size may return 0 (non error, EOF).
This change fixes following error:
nbd-client -N unexistent 127.0.0.1 /dev/nbd0
Negotiation: ..size = 2314498962MBError: Exported device is too big for me. Get 64-bit machine :-(
Exiting.
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");
+ }
size64 = ntohll(size64);
#ifdef NBD_SET_SIZE_BLOCKS