NBD-server v3.2 has a problem: if a client does a read-request of 0
bytes in length, then the nbd-server does not return a response header.
This is not in line with a write request which always returns a response
header.
This patch solves that behaviour.
case NBD_CMD_READ:
DEBUG("exp->buf, ");
- memcpy(buf, &reply, sizeof(struct nbd_reply));
if (client->transactionlogfd != -1)
writeit(client->transactionlogfd, &reply, sizeof(reply));
- p = buf + sizeof(struct nbd_reply);
- writelen = currlen + sizeof(struct nbd_reply);
+ writeit(client->net, &reply, sizeof(reply));
+ p = buf;
+ writelen = currlen;
while(len > 0) {
if (expread(request.from, p, currlen, client)) {
DEBUG("Read failed: %m");