aboutsummaryrefslogtreecommitdiff
path: root/qmp.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-01-13 17:07:15 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-01-29 09:58:56 +0100
commitb25d81ba332dc06757d40ffe64944ba27082de0a (patch)
treefe7ca152bebf917ff97ddcbb1b4e01d4e5d47f5f /qmp.c
parent83761b9244ad2ed39d3cfabe8a0e901ab906f7bf (diff)
qmp hmp: Factor out common "using spice" test
Into qemu_using_spice(). For want of a better place, put it next the existing monitor command handler dummies in qemu-spice.h. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'qmp.c')
-rw-r--r--qmp.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/qmp.c b/qmp.c
index 963305c269..ef155ff3aa 100644
--- a/qmp.c
+++ b/qmp.c
@@ -287,9 +287,7 @@ void qmp_set_password(const char *protocol, const char *password,
}
if (strcmp(protocol, "spice") == 0) {
- if (!using_spice) {
- /* correct one? spice isn't a device ,,, */
- error_set(errp, QERR_DEVICE_NOT_ACTIVE, "spice");
+ if (!qemu_using_spice(errp)) {
return;
}
rc = qemu_spice_set_passwd(password, fail_if_connected,
@@ -335,9 +333,7 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
}
if (strcmp(protocol, "spice") == 0) {
- if (!using_spice) {
- /* correct one? spice isn't a device ,,, */
- error_set(errp, QERR_DEVICE_NOT_ACTIVE, "spice");
+ if (!qemu_using_spice(errp)) {
return;
}
rc = qemu_spice_set_pw_expire(when);
@@ -575,8 +571,7 @@ void qmp_add_client(const char *protocol, const char *fdname,
}
if (strcmp(protocol, "spice") == 0) {
- if (!using_spice) {
- error_set(errp, QERR_DEVICE_NOT_ACTIVE, "spice");
+ if (!qemu_using_spice(errp)) {
close(fd);
return;
}