}
if (virSetNonBlock(monfd) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Unable to put monitor into non-blocking mode"));
+ virReportSystemError(errno, "%s",
+ _("Unable to put monitor "
+ "into non-blocking mode"));
goto error;
}
if (virSetCloseExec(monfd) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Unable to set monitor close-on-exec flag"));
+ virReportSystemError(errno, "%s",
+ _("Unable to set monitor "
+ "close-on-exec flag"));
goto error;
}
int monfd;
if ((monfd = open(monitor, O_RDWR | O_NONBLOCK)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to open monitor path %s"), monitor);
+ virReportSystemError(errno,
+ _("Unable to open monitor path %s"), monitor);
return -1;
}
if (virSetCloseExec(monfd) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("Unable to set monitor close-on-exec flag"));
+ virReportSystemError(errno, "%s",
+ _("Unable to set monitor close-on-exec flag"));
goto error;
}
return NULL;
if (virMutexInit(&mon->lock) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot initialize monitor mutex"));
+ virReportSystemError(errno, "%s",
+ _("cannot initialize monitor mutex"));
VIR_FREE(mon);
return NULL;
}
if (virCondInit(&mon->notify) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot initialize monitor condition"));
+ virReportSystemError(errno, "%s",
+ _("cannot initialize monitor condition"));
virMutexDestroy(&mon->lock);
VIR_FREE(mon);
return NULL;
_("Guest agent not available for now"));
ret = -2;
} else {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to wait on monitor condition"));
+ virReportSystemError(errno, "%s",
+ _("Unable to wait on monitor condition"));
}
goto cleanup;
}