Commit fc6467ea authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

nbd: fix nbd_server_stop crash when no server was running



This failed on the new assertion of qemu_set_fd_handler2:

qemu-system-x86_64: /home/pbonzini/work/upstream/qemu/iohandler.c:60: qemu_set_fd_handler2: Assertion `fd >= 0' failed.

Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 1d7d2a9d
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -113,7 +113,9 @@ void qmp_nbd_server_stop(Error **errp)
        nbd_close_notifier(&cn->n, nbd_export_get_blockdev(cn->exp));
    }

    if (server_fd != -1) {
        qemu_set_fd_handler2(server_fd, NULL, NULL, NULL, NULL);
        close(server_fd);
        server_fd = -1;
    }
}