diff mbox

[26/36] qmp: check that async command have an 'id'

Message ID 1443189844-20341-27-git-send-email-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Sept. 25, 2015, 2:03 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

The async support mandates that request have an 'id' (see documentation
in following patch).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qapi/qmp-dispatch.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox

Patch

diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 83ecab5..73ba3ad 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -105,6 +105,11 @@  static QObject *do_qmp_dispatch(QObject *request, QmpReturn *qret, Error **errp)
         }
         break;
     case QCT_ASYNC:
+        if (!qdict_haskey(qret->rsp, "id")) {
+            error_setg(errp, "An async command requires an 'id'");
+            break;
+        }
+
         cmd->fn_async(args, qret);
         break;
     }