mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
lib: Use virReportSystemError() more
Instead of reporting virReportError(..., g_strerror(), ...) let's use proper virReportSystemError(). Generated with help of cocci: @@ expression c; @@ <... - virReportError(c, + virReportSystemError(errno, ..., - g_strerror(errno), ...); ...> But then I had to hand fix format strings, because I'm not sure if cocci even knows how to do that. And even if it did, I surely don't. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4f8ae0353f
commit
19a5b054ac
@ -1775,10 +1775,9 @@ libxlDriverConfigInit(libxlDriverConfig *cfg)
|
|||||||
uint64_t free_mem;
|
uint64_t free_mem;
|
||||||
|
|
||||||
if (g_mkdir_with_parents(cfg->logDir, 0777) < 0) {
|
if (g_mkdir_with_parents(cfg->logDir, 0777) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportSystemError(errno,
|
||||||
_("failed to create log dir '%s': %s"),
|
_("failed to create log dir '%s'"),
|
||||||
cfg->logDir,
|
cfg->logDir);
|
||||||
g_strerror(errno));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,38 +721,33 @@ libxlStateInitialize(bool privileged,
|
|||||||
|
|
||||||
libxl_driver->config = cfg;
|
libxl_driver->config = cfg;
|
||||||
if (g_mkdir_with_parents(cfg->stateDir, 0777) < 0) {
|
if (g_mkdir_with_parents(cfg->stateDir, 0777) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportSystemError(errno,
|
||||||
_("failed to create state dir '%s': %s"),
|
_("failed to create state dir '%s'"),
|
||||||
cfg->stateDir,
|
cfg->stateDir);
|
||||||
g_strerror(errno));
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (g_mkdir_with_parents(cfg->libDir, 0777) < 0) {
|
if (g_mkdir_with_parents(cfg->libDir, 0777) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportSystemError(errno,
|
||||||
_("failed to create lib dir '%s': %s"),
|
_("failed to create lib dir '%s'"),
|
||||||
cfg->libDir,
|
cfg->libDir);
|
||||||
g_strerror(errno));
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (g_mkdir_with_parents(cfg->saveDir, 0777) < 0) {
|
if (g_mkdir_with_parents(cfg->saveDir, 0777) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportSystemError(errno,
|
||||||
_("failed to create save dir '%s': %s"),
|
_("failed to create save dir '%s'"),
|
||||||
cfg->saveDir,
|
cfg->saveDir);
|
||||||
g_strerror(errno));
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (g_mkdir_with_parents(cfg->autoDumpDir, 0777) < 0) {
|
if (g_mkdir_with_parents(cfg->autoDumpDir, 0777) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportSystemError(errno,
|
||||||
_("failed to create dump dir '%s': %s"),
|
_("failed to create dump dir '%s'"),
|
||||||
cfg->autoDumpDir,
|
cfg->autoDumpDir);
|
||||||
g_strerror(errno));
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (g_mkdir_with_parents(cfg->channelDir, 0777) < 0) {
|
if (g_mkdir_with_parents(cfg->channelDir, 0777) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportSystemError(errno,
|
||||||
_("failed to create channel dir '%s': %s"),
|
_("failed to create channel dir '%s'"),
|
||||||
cfg->channelDir,
|
cfg->channelDir);
|
||||||
g_strerror(errno));
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,11 +368,11 @@ qemuCreateInBridgePortWithHelper(virQEMUDriverConfig *cfg,
|
|||||||
virCommandAbort(cmd);
|
virCommandAbort(cmd);
|
||||||
|
|
||||||
if (errbuf && *errbuf)
|
if (errbuf && *errbuf)
|
||||||
errstr = g_strdup_printf("\nstderr=%s", errbuf);
|
errstr = g_strdup_printf("stderr=%s", errbuf);
|
||||||
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportSystemError(errno,
|
||||||
_("%s: failed to communicate with bridge helper: %s%s"),
|
_("%s: failed to communicate with bridge helper: %s"),
|
||||||
cmdstr, g_strerror(errno),
|
cmdstr,
|
||||||
NULLSTR_EMPTY(errstr));
|
NULLSTR_EMPTY(errstr));
|
||||||
VIR_FREE(errstr);
|
VIR_FREE(errstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user