copy handle on all requests
authorAlex Bligh <alex@alex.org.uk>
Wed, 18 May 2011 18:02:48 +0000 (19:02 +0100)
committerAlex Bligh <alex@alex.org.uk>
Wed, 18 May 2011 18:02:48 +0000 (19:02 +0100)
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
                                "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)) {
                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);
                        if ((request.from + len) > (OFFT_MAX)) {
                                DEBUG("[Number too large!]");
                                ERROR(client, reply, EINVAL);