diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 2bd1e4c387..8f97ac032c 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -364,10 +364,8 @@ bhyveDomainSetAutostart(virDomainPtr domain, int autostart) autostart = (autostart != 0); if (vm->autostart != autostart) { - if ((configFile = virDomainConfigFile(BHYVE_CONFIG_DIR, vm->def->name)) == NULL) - goto cleanup; - if ((autostartLink = virDomainConfigFile(BHYVE_AUTOSTART_DIR, vm->def->name)) == NULL) - goto cleanup; + configFile = virDomainConfigFile(BHYVE_CONFIG_DIR, vm->def->name); + autostartLink = virDomainConfigFile(BHYVE_AUTOSTART_DIR, vm->def->name); if (autostart) { if (g_mkdir_with_parents(BHYVE_AUTOSTART_DIR, 0777) < 0) { diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4ad8289b89..3c19c89af9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29002,8 +29002,7 @@ virDomainDefSaveXML(virDomainDef *def, if (!configDir) return 0; - if ((configFile = virDomainConfigFile(configDir, def->name)) == NULL) - return -1; + configFile = virDomainConfigFile(configDir, def->name); if (g_mkdir_with_parents(configDir, 0777) < 0) { virReportSystemError(errno, @@ -29060,11 +29059,8 @@ virDomainDeleteConfig(const char *configDir, g_autofree char *configFile = NULL; g_autofree char *autostartLink = NULL; - if ((configFile = virDomainConfigFile(configDir, dom->def->name)) == NULL) - return -1; - if ((autostartLink = virDomainConfigFile(autostartDir, - dom->def->name)) == NULL) - return -1; + configFile = virDomainConfigFile(configDir, dom->def->name); + autostartLink = virDomainConfigFile(autostartDir, dom->def->name); /* Not fatal if this doesn't work */ unlink(autostartLink); diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c index 166bbc5cfd..72207450c5 100644 --- a/src/conf/virdomainobjlist.c +++ b/src/conf/virdomainobjlist.c @@ -492,16 +492,14 @@ virDomainObjListLoadConfig(virDomainObjList *doms, int autostart; g_autoptr(virDomainDef) oldDef = NULL; - if ((configFile = virDomainConfigFile(configDir, name)) == NULL) - return NULL; + configFile = virDomainConfigFile(configDir, name); if (!(def = virDomainDefParseFile(configFile, xmlopt, NULL, VIR_DOMAIN_DEF_PARSE_INACTIVE | VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE | VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL))) return NULL; - if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL) - return NULL; + autostartLink = virDomainConfigFile(autostartDir, name); autostart = virFileLinkPointsTo(autostartLink, configFile); @@ -529,8 +527,7 @@ virDomainObjListLoadStatus(virDomainObjList *doms, virDomainObj *obj = NULL; char uuidstr[VIR_UUID_STRING_BUFLEN]; - if ((statusFile = virDomainConfigFile(statusDir, name)) == NULL) - goto error; + statusFile = virDomainConfigFile(statusDir, name); if (!(obj = virDomainObjParseFile(statusFile, xmlopt, VIR_DOMAIN_DEF_PARSE_STATUS | diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 2c0cf75562..494b1ad9bc 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -4656,10 +4656,8 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart) autostart = (autostart != 0); if (vm->autostart != autostart) { - if (!(configFile = virDomainConfigFile(cfg->configDir, vm->def->name))) - goto endjob; - if (!(autostartLink = virDomainConfigFile(cfg->autostartDir, vm->def->name))) - goto endjob; + configFile = virDomainConfigFile(cfg->configDir, vm->def->name); + autostartLink = virDomainConfigFile(cfg->autostartDir, vm->def->name); if (autostart) { if (g_mkdir_with_parents(cfg->autostartDir, 0777) < 0) { diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 7b432a1160..fb7f8e0bc2 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -196,9 +196,7 @@ static virLXCController *virLXCControllerNew(const char *name) if (!(driver = virLXCControllerDriverNew())) goto error; - if ((configFile = virDomainConfigFile(LXC_STATE_DIR, - ctrl->name)) == NULL) - goto error; + configFile = virDomainConfigFile(LXC_STATE_DIR, ctrl->name); if ((ctrl->vm = virDomainObjParseFile(configFile, driver->xmlopt, diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index cc4b2a05d6..4740aeed52 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -2439,14 +2439,8 @@ static int lxcDomainSetAutostart(virDomainPtr dom, goto endjob; } - configFile = virDomainConfigFile(cfg->configDir, - vm->def->name); - if (configFile == NULL) - goto endjob; - autostartLink = virDomainConfigFile(cfg->autostartDir, - vm->def->name); - if (autostartLink == NULL) - goto endjob; + configFile = virDomainConfigFile(cfg->configDir, vm->def->name); + autostartLink = virDomainConfigFile(cfg->autostartDir, vm->def->name); if (autostart) { if (g_mkdir_with_parents(cfg->autostartDir, 0777) < 0) { diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 388aa2b34e..d2eddbd9ae 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7790,12 +7790,8 @@ static int qemuDomainSetAutostart(virDomainPtr dom, if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; - if (!(configFile = virDomainConfigFile(cfg->configDir, vm->def->name))) - goto endjob; - - if (!(autostartLink = virDomainConfigFile(cfg->autostartDir, - vm->def->name))) - goto endjob; + configFile = virDomainConfigFile(cfg->configDir, vm->def->name); + autostartLink = virDomainConfigFile(cfg->autostartDir, vm->def->name); if (autostart) { if (g_mkdir_with_parents(cfg->autostartDir, 0777) < 0) { @@ -18345,21 +18341,15 @@ qemuDomainRenameCallback(virDomainObj *vm, new_dom_name = g_strdup(new_name); - if (!(new_dom_cfg_file = virDomainConfigFile(cfg->configDir, - new_dom_name)) || - !(old_dom_cfg_file = virDomainConfigFile(cfg->configDir, - vm->def->name))) - return -1; + new_dom_cfg_file = virDomainConfigFile(cfg->configDir, new_dom_name); + old_dom_cfg_file = virDomainConfigFile(cfg->configDir, vm->def->name); if (qemuDomainNamePathsCleanup(cfg, new_name, false) < 0) goto cleanup; if (vm->autostart) { - if (!(new_dom_autostart_link = virDomainConfigFile(cfg->autostartDir, - new_dom_name)) || - !(old_dom_autostart_link = virDomainConfigFile(cfg->autostartDir, - vm->def->name))) - return -1; + new_dom_autostart_link = virDomainConfigFile(cfg->autostartDir, new_dom_name); + old_dom_autostart_link = virDomainConfigFile(cfg->autostartDir, vm->def->name); if (symlink(new_dom_cfg_file, new_dom_autostart_link) < 0) { virReportSystemError(errno,