diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2015-03-20 09:50:08 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-03-20 09:50:08 +0000 |
commit | e7e9b49f8e9ea4c5c9d07f6d8c9071c64dae816a (patch) | |
tree | 65b1d956bde902c9a772b23c0f40b1ebb83d0ad1 /monitor.c | |
parent | 3e5f6234b4f45a11b7c357dde2d6da36641bc6f6 (diff) | |
parent | 4e289b1b62c8e271e3400317b4c3d98909093bc4 (diff) | |
download | qemu-e7e9b49f8e9ea4c5c9d07f6d8c9071c64dae816a.tar.gz qemu-e7e9b49f8e9ea4c5c9d07f6d8c9071c64dae816a.tar.bz2 qemu-e7e9b49f8e9ea4c5c9d07f6d8c9071c64dae816a.zip |
Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20150320-1' into staging
usb: bugfix collection.
# gpg: Signature made Fri Mar 20 07:51:19 2015 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
* remotes/kraxel/tags/pull-usb-20150320-1:
ehci: fix segfault when hot-unplugging ehci controller
ohci: fix resource cleanup leak
uhci: fix segfault when hot-unplugging uhci controller
hw/usb: Include USB files only if necessary
usb/dev-storage: Avoid qerror_report_err() outside QMP handlers
usb/dev-storage: Fix QMP device_add missing encryption key failure
monitor usb: Inline monitor_read_bdrv_key_start()'s first part
monitor: Plug memory leak in monitor_read_bdrv_key_start()
monitor: Drop dead QMP check from monitor_read_password()
uhci: Convert to realize
ohci: Complete conversion to realize
usb: Improve companion configuration error messages
usb: Propagate errors through usb_register_companion()
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 32 |
1 files changed, 12 insertions, 20 deletions
@@ -266,10 +266,7 @@ void monitor_read_command(Monitor *mon, int show_prompt) int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, void *opaque) { - if (monitor_ctrl_mode(mon)) { - qerror_report(QERR_MISSING_PARAMETER, "password"); - return -EINVAL; - } else if (mon->rs) { + if (mon->rs) { readline_start(mon->rs, "Password: ", 1, readline_func, opaque); /* prompt is printed on return from the command handler */ return 0; @@ -5389,23 +5386,8 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, BlockCompletionFunc *completion_cb, void *opaque) { - Error *local_err = NULL; int err; - bdrv_add_key(bs, NULL, &local_err); - if (!local_err) { - if (completion_cb) - completion_cb(opaque, 0); - return 0; - } - - /* Need a key for @bs */ - - if (monitor_ctrl_mode(mon)) { - qerror_report_err(local_err); - return -1; - } - monitor_printf(mon, "%s (%s) is encrypted.\n", bdrv_get_device_name(bs), bdrv_get_encrypted_filename(bs)); @@ -5424,6 +5406,7 @@ int monitor_read_block_device_key(Monitor *mon, const char *device, BlockCompletionFunc *completion_cb, void *opaque) { + Error *err = NULL; BlockBackend *blk; blk = blk_by_name(device); @@ -5432,7 +5415,16 @@ int monitor_read_block_device_key(Monitor *mon, const char *device, return -1; } - return monitor_read_bdrv_key_start(mon, blk_bs(blk), completion_cb, opaque); + bdrv_add_key(blk_bs(blk), NULL, &err); + if (err) { + error_free(err); + return monitor_read_bdrv_key_start(mon, blk_bs(blk), completion_cb, opaque); + } + + if (completion_cb) { + completion_cb(opaque, 0); + } + return 0; } QemuOptsList qemu_mon_opts = { |