copy handle on all requests
[nbd.git] / nbd-server.c
index 21fa563..4122cef 100644 (file)
@@ -1452,8 +1452,9 @@ int mainloop(CLIENT *client) {
                                "READ", (unsigned long long)request.from,
                                (unsigned long long)request.from / 512, len);
 #endif
+               memcpy(reply.handle, request.handle, sizeof(reply.handle));
+
                if ((command==NBD_CMD_WRITE) || (command==NBD_CMD_READ)) {
-                       memcpy(reply.handle, request.handle, sizeof(reply.handle));
                        if ((request.from + len) > (OFFT_MAX)) {
                                DEBUG("[Number too large!]");
                                ERROR(client, reply, EINVAL);