diff options
author | Max Reitz <mreitz@redhat.com> | 2015-02-25 13:08:21 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-03-18 12:06:50 +0100 |
commit | 98f44bbe70bb803e7be2421b7cc92a1c179afb87 (patch) | |
tree | f257e066f4dd5d13044315941367b47d6336e017 /blockdev-nbd.c | |
parent | 892f5a5270f9f3cae4f384dffbf70679fa2a57b6 (diff) | |
download | qemu-98f44bbe70bb803e7be2421b7cc92a1c179afb87.zip qemu-98f44bbe70bb803e7be2421b7cc92a1c179afb87.tar.gz qemu-98f44bbe70bb803e7be2421b7cc92a1c179afb87.tar.bz2 |
nbd: Handle blk_getlength() failure
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <1424887718-10800-9-git-send-email-mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'blockdev-nbd.c')
-rw-r--r-- | blockdev-nbd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/blockdev-nbd.c b/blockdev-nbd.c index 22e95d1..b29e456 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -105,7 +105,11 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable, writable = false; } - exp = nbd_export_new(blk, 0, -1, writable ? 0 : NBD_FLAG_READ_ONLY, NULL); + exp = nbd_export_new(blk, 0, -1, writable ? 0 : NBD_FLAG_READ_ONLY, NULL, + errp); + if (!exp) { + return; + } nbd_export_set_name(exp, device); |