提交 fba29dff 编写于 作者: J Ján Tomko

tests: qemuMonitorReportError: use tmp variable properly

There is no obvious benefit in putting the escaped message
back into msg while tmp holds the original message.

Remove the assignment and use 'tmp' directly'.
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 87bd4377
...@@ -213,16 +213,14 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const char *errmsg, ...) ...@@ -213,16 +213,14 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const char *errmsg, ...)
goto cleanup; goto cleanup;
if (test->agent || test->json) { if (test->agent || test->json) {
char *tmp = msg; VIR_AUTOFREE(char *) tmp = NULL;
msg = qemuMonitorEscapeArg(tmp); if (!(tmp = qemuMonitorEscapeArg(msg)))
VIR_FREE(tmp);
if (!msg)
goto cleanup; goto cleanup;
if (virAsprintf(&jsonmsg, "{ \"error\": " if (virAsprintf(&jsonmsg, "{ \"error\": "
" { \"desc\": \"%s\", " " { \"desc\": \"%s\", "
" \"class\": \"UnexpectedCommand\" } }", " \"class\": \"UnexpectedCommand\" } }",
msg) < 0) tmp) < 0)
goto cleanup; goto cleanup;
} else { } else {
if (virAsprintf(&jsonmsg, "error: '%s'", msg) < 0) if (virAsprintf(&jsonmsg, "error: '%s'", msg) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册