diff --git a/server/protocol.c b/server/protocol.c index ac6eb2c..d406dc8 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -503,6 +503,9 @@ send_structured_reply_block_status (struct connection *conn, if (blocks == NULL) return connection_set_status (conn, -1); + nr_blocks = 32; + blocks[0].length = htobe32 (4096); + reply.magic = htobe32 (NBD_STRUCTURED_REPLY_MAGIC); reply.handle = handle; reply.flags = htobe16 (NBD_REPLY_FLAG_DONE); @@ -526,7 +529,7 @@ send_structured_reply_block_status (struct connection *conn, /* Send each block descriptor. */ for (i = 0; i < nr_blocks; ++i) { - r = conn->send (conn, &blocks[i], sizeof blocks[i]); + r = conn->send (conn, &blocks[0], sizeof blocks[0]); if (r == -1) { nbdkit_error ("write reply: %s: %m", name_of_nbd_cmd (cmd)); return connection_set_status (conn, -1);