nbd: Fix uninitialised use of s->sock
authorKevin Wolf <kwolf@redhat.com>
Thu, 26 Apr 2012 11:45:30 +0000 (13:45 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 26 Apr 2012 15:54:22 +0000 (17:54 +0200)
s->sock is assigned only afterwards, so we're really registering an
aio_fd_handler for file descriptor 0 here. Not exactly what we intended.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block/nbd.c

index 56dbf6ef863eaf33f312aeaba1d8635c6004e2a6..1212614223ed1debcb719ca95580b7e80f6c68e0 100644 (file)
@@ -284,7 +284,7 @@ static int nbd_establish_connection(BlockDriverState *bs)
     /* Now that we're connected, set the socket to be non-blocking and
      * kick the reply mechanism.  */
     socket_set_nonblock(sock);
-    qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, NULL,
+    qemu_aio_set_fd_handler(sock, nbd_reply_ready, NULL,
                             nbd_have_request, s);
 
     s->sock = sock;