if (virAsprintf(&log_file, "%s/libxl-driver.log", cfg->logDir) < 0)
goto error;
+ if (virFileMakePath(cfg->logDir) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to create log dir '%s': %s"),
+ cfg->logDir,
+ virStrerror(errno, ebuf, sizeof(ebuf)));
+ goto error;
+ }
+
if ((cfg->logger_file = fopen(log_file, "a")) == NULL) {
VIR_ERROR(_("Failed to create log file '%s': %s"),
log_file, virStrerror(errno, ebuf, sizeof(ebuf)));
goto error;
libxl_driver->config = cfg;
- if (virFileMakePath(cfg->logDir) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("failed to create log dir '%s': %s"),
- cfg->logDir,
- virStrerror(errno, ebuf, sizeof(ebuf)));
- goto error;
- }
if (virFileMakePath(cfg->stateDir) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("failed to create state dir '%s': %s"),