提交 3ba5d77f 编写于 作者: M Matthias Bolte

Move call to virReportOOMError into virFileBuildPath

Suggested by Daniel P. Berrange
上级 59a5981d
......@@ -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;
}
}
......
......@@ -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;
}
......
......@@ -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;
}
}
......
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册