1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-12 13:17:58 +03:00

Move call to virReportOOMError into virFileBuildPath

Suggested by Daniel P. Berrange
This commit is contained in:
Matthias Bolte 2011-04-24 11:48:00 +02:00
parent 59a5981dd3
commit 3ba5d77f3c
5 changed files with 5 additions and 15 deletions

View File

@ -2588,10 +2588,8 @@ virNWFilterLoadAllConfigs(virConnectPtr conn,
if (!virFileHasSuffix(entry->d_name, ".xml"))
continue;
if (!(path = virFileBuildPath(configDir, entry->d_name, NULL))) {
virReportOOMError();
if (!(path = virFileBuildPath(configDir, entry->d_name, NULL)))
continue;
}
nwfilter = virNWFilterObjLoad(conn, nwfilters, entry->d_name, path);
if (nwfilter)
@ -2627,7 +2625,6 @@ virNWFilterObjSaveDef(virNWFilterDriverStatePtr driver,
if (!(nwfilter->configFile = virFileBuildPath(driver->configDir,
def->name, ".xml"))) {
virReportOOMError();
return -1;
}
}

View File

@ -1483,14 +1483,11 @@ virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
if (!virFileHasSuffix(entry->d_name, ".xml"))
continue;
if (!(path = virFileBuildPath(configDir, entry->d_name, NULL))) {
virReportOOMError();
if (!(path = virFileBuildPath(configDir, entry->d_name, NULL)))
continue;
}
if (!(autostartLink = virFileBuildPath(autostartDir, entry->d_name,
NULL))) {
virReportOOMError();
VIR_FREE(path);
continue;
}
@ -1529,13 +1526,11 @@ virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
if (!(pool->configFile = virFileBuildPath(driver->configDir,
def->name, ".xml"))) {
virReportOOMError();
return -1;
}
if (!(pool->autostartLink = virFileBuildPath(driver->autostartDir,
def->name, ".xml"))) {
virReportOOMError();
VIR_FREE(pool->configFile);
return -1;
}

View File

@ -1829,10 +1829,12 @@ virFileBuildPath(const char *dir, const char *name, const char *ext)
if (ext == NULL) {
if (virAsprintf(&path, "%s/%s", dir, name) < 0) {
virReportOOMError();
return NULL;
}
} else {
if (virAsprintf(&path, "%s/%s%s", dir, name, ext) < 0) {
virReportOOMError();
return NULL;
}
}

View File

@ -415,7 +415,6 @@ xenInotifyOpen(virConnectPtr conn,
/* Build the full file path */
if (!(path = virFileBuildPath(priv->configDir, ent->d_name, NULL))) {
virReportOOMError();
closedir(dh);
return -1;
}

View File

@ -388,7 +388,6 @@ int xenXMConfigCacheRefresh (virConnectPtr conn) {
/* Build the full file path */
if (!(path = virFileBuildPath(priv->configDir, ent->d_name, NULL))) {
virReportOOMError();
closedir(dh);
return -1;
}
@ -1134,10 +1133,8 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
entry = NULL;
}
if (!(filename = virFileBuildPath(priv->configDir, def->name, NULL))) {
virReportOOMError();
if (!(filename = virFileBuildPath(priv->configDir, def->name, NULL)))
goto error;
}
if (xenXMConfigSaveFile(conn, filename, def) < 0)
goto error;