mirror of https://github.com/mamba-org/mamba.git
close json repodata file after opening (#1309)
This commit is contained in:
parent
6c8b14f9d8
commit
7b51c6f899
|
@ -329,6 +329,7 @@ namespace mamba
|
||||||
int ret = repo_add_conda(m_repo, fp, flags);
|
int ret = repo_add_conda(m_repo, fp, flags);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
|
fclose(fp);
|
||||||
throw std::runtime_error("Could not read JSON repodata file (" + m_json_file + ") "
|
throw std::runtime_error("Could not read JSON repodata file (" + m_json_file + ") "
|
||||||
+ std::string(pool_errstr(m_repo->pool)));
|
+ std::string(pool_errstr(m_repo->pool)));
|
||||||
}
|
}
|
||||||
|
@ -346,6 +347,7 @@ namespace mamba
|
||||||
write();
|
write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,12 +370,19 @@ namespace mamba
|
||||||
repodata_set_str(info, SOLVID_META, etag_id, m_metadata.etag.c_str());
|
repodata_set_str(info, SOLVID_META, etag_id, m_metadata.etag.c_str());
|
||||||
repodata_set_str(info, SOLVID_META, mod_id, m_metadata.mod.c_str());
|
repodata_set_str(info, SOLVID_META, mod_id, m_metadata.mod.c_str());
|
||||||
|
|
||||||
auto solv_f = fopen(m_solv_file.c_str(), "wb");
|
|
||||||
repodata_internalize(info);
|
repodata_internalize(info);
|
||||||
|
|
||||||
|
auto solv_f = fopen(m_solv_file.c_str(), "wb");
|
||||||
|
if (!solv_f)
|
||||||
|
{
|
||||||
|
LOG_ERROR << "Failed to open .solv file";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (repo_write(m_repo, solv_f) != 0)
|
if (repo_write(m_repo, solv_f) != 0)
|
||||||
{
|
{
|
||||||
LOG_ERROR << "Failed to write .solv:" << pool_errstr(m_repo->pool);
|
LOG_ERROR << "Failed to write .solv:" << pool_errstr(m_repo->pool);
|
||||||
|
fclose(solv_f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue