| Submitter | Michael Roth |
|---|---|
| Date | April 18, 2011, 3:02 p.m. |
| Message ID | <1303138953-1334-6-git-send-email-mdroth@linux.vnet.ibm.com> |
| Download | mbox | patch |
| Permalink | /patch/91782/ |
| State | New |
| Headers | show |
Comments
Patch
diff --git a/qmp-core.c b/qmp-core.c index e33f7a4..9f3d182 100644 --- a/qmp-core.c +++ b/qmp-core.c @@ -922,9 +922,12 @@ void qmp_async_complete_command(QmpCommandState *cmd, QObject *retval, Error *er rsp = qdict_new(); if (err) { qdict_put_obj(rsp, "error", error_get_qobject(err)); - } else { + } else if (retval) { qobject_incref(retval); qdict_put_obj(rsp, "return", retval); + } else { + /* add empty "return" dict, this is the standard for NULL returns */ + qdict_put_obj(rsp, "return", QOBJECT(qdict_new())); } if (cmd->tag) { qdict_put_obj(rsp, "tag", cmd->tag);
Async commands like 'guest-ping' have NULL retvals. Handle these by inserting an empty dictionary in the response's "return" field. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> --- qmp-core.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)