提交 3e0cc630 编写于 作者: M Michal Privoznik

qemu_agent: Switch to virReportSystemError() on system error

Currently, if a syscall in qemu_agent.c fails we report an internal
error even though we should be reporting a system error.
上级 aa3e8bd4
...@@ -191,14 +191,16 @@ qemuAgentOpenUnix(const char *monitor, pid_t cpid, bool *inProgress) ...@@ -191,14 +191,16 @@ qemuAgentOpenUnix(const char *monitor, pid_t cpid, bool *inProgress)
} }
if (virSetNonBlock(monfd) < 0) { if (virSetNonBlock(monfd) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportSystemError(errno, "%s",
"%s", _("Unable to put monitor into non-blocking mode")); _("Unable to put monitor "
"into non-blocking mode"));
goto error; goto error;
} }
if (virSetCloseExec(monfd) < 0) { if (virSetCloseExec(monfd) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportSystemError(errno, "%s",
"%s", _("Unable to set monitor close-on-exec flag")); _("Unable to set monitor "
"close-on-exec flag"));
goto error; goto error;
} }
...@@ -256,14 +258,14 @@ qemuAgentOpenPty(const char *monitor) ...@@ -256,14 +258,14 @@ qemuAgentOpenPty(const char *monitor)
int monfd; int monfd;
if ((monfd = open(monitor, O_RDWR | O_NONBLOCK)) < 0) { if ((monfd = open(monitor, O_RDWR | O_NONBLOCK)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportSystemError(errno,
_("Unable to open monitor path %s"), monitor); _("Unable to open monitor path %s"), monitor);
return -1; return -1;
} }
if (virSetCloseExec(monfd) < 0) { if (virSetCloseExec(monfd) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportSystemError(errno, "%s",
"%s", _("Unable to set monitor close-on-exec flag")); _("Unable to set monitor close-on-exec flag"));
goto error; goto error;
} }
...@@ -733,14 +735,14 @@ qemuAgentOpen(virDomainObjPtr vm, ...@@ -733,14 +735,14 @@ qemuAgentOpen(virDomainObjPtr vm,
return NULL; return NULL;
if (virMutexInit(&mon->lock) < 0) { if (virMutexInit(&mon->lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportSystemError(errno, "%s",
_("cannot initialize monitor mutex")); _("cannot initialize monitor mutex"));
VIR_FREE(mon); VIR_FREE(mon);
return NULL; return NULL;
} }
if (virCondInit(&mon->notify) < 0) { if (virCondInit(&mon->notify) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportSystemError(errno, "%s",
_("cannot initialize monitor condition")); _("cannot initialize monitor condition"));
virMutexDestroy(&mon->lock); virMutexDestroy(&mon->lock);
VIR_FREE(mon); VIR_FREE(mon);
return NULL; return NULL;
...@@ -884,8 +886,8 @@ static int qemuAgentSend(qemuAgentPtr mon, ...@@ -884,8 +886,8 @@ static int qemuAgentSend(qemuAgentPtr mon,
_("Guest agent not available for now")); _("Guest agent not available for now"));
ret = -2; ret = -2;
} else { } else {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportSystemError(errno, "%s",
_("Unable to wait on monitor condition")); _("Unable to wait on monitor condition"));
} }
goto cleanup; goto cleanup;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册