/*
* qemu_agent.h: interaction with QEMU guest agent
*
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
memset(&msg, 0, sizeof(msg));
- if (!(cmdstr = virJSONValueToString(cmd, false))) {
- virReportOOMError();
+ if (!(cmdstr = virJSONValueToString(cmd, false)))
goto cleanup;
- }
if (virAsprintf(&msg.txBuffer, "%s" LINE_ENDING, cmdstr) < 0) {
virReportOOMError();
goto cleanup;
/* Log the full JSON formatted command & error */
VIR_DEBUG("unable to execute QEMU agent command %s: %s",
- cmdstr, replystr);
+ NULLSTR(cmdstr), NULLSTR(replystr));
/* Only send the user the command name + friendly error */
if (!error)
char *replystr = virJSONValueToString(reply, false);
VIR_DEBUG("Neither 'return' nor 'error' is set in the JSON reply %s: %s",
- cmdstr, replystr);
+ NULLSTR(cmdstr), NULLSTR(replystr));
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unable to execute QEMU agent command '%s'"),
qemuAgentCommandName(cmd));
if (ret == 0) {
ret = qemuAgentCheckError(cmd, reply);
- *result = virJSONValueToString(reply, false);
+ if (!(*result = virJSONValueToString(reply, false)))
+ ret = -1;
}
virJSONValueFree(cmd);
}
}
- if (!(cmdstr = virJSONValueToString(cmd, false))) {
- virReportOOMError();
+ if (!(cmdstr = virJSONValueToString(cmd, false)))
goto cleanup;
- }
if (virAsprintf(&msg.txBuffer, "%s\r\n", cmdstr) < 0) {
virReportOOMError();
goto cleanup;
/* Log the full JSON formatted command & error */
VIR_DEBUG("unable to execute QEMU command %s: %s",
- cmdstr, replystr);
+ NULLSTR(cmdstr), NULLSTR(replystr));
/* Only send the user the command name + friendly error */
if (!error)
char *replystr = virJSONValueToString(reply, false);
VIR_DEBUG("Neither 'return' nor 'error' is set in the JSON reply %s: %s",
- cmdstr, replystr);
+ NULLSTR(cmdstr), NULLSTR(replystr));
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unable to execute QEMU command '%s'"),
qemuMonitorJSONCommandName(cmd));