Skip to content

Commit

Permalink
Prevent exiting with 0 if errors occur while finalizing repodata.
Browse files Browse the repository at this point in the history
  • Loading branch information
kontura authored and Conan-Kudo committed May 24, 2019
1 parent 0e26638 commit aa36ceb
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions src/createrepo_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,9 +1110,16 @@ main(int argc, char **argv)

cr_xml_dump_cleanup();

cr_xmlfile_close(pri_cr_file, NULL);
cr_xmlfile_close(fil_cr_file, NULL);
cr_xmlfile_close(oth_cr_file, NULL);
cr_xmlfile_close(pri_cr_file, &tmp_err);
if (!tmp_err)
cr_xmlfile_close(fil_cr_file, &tmp_err);
if (!tmp_err)
cr_xmlfile_close(oth_cr_file, &tmp_err);
if (tmp_err) {
g_critical("Error while closing xml files: %s", tmp_err->message);
g_clear_error(&tmp_err);
exit(EXIT_FAILURE);
}

cr_xmlfile_close(pri_cr_zck, &tmp_err);
if (tmp_err) {
Expand Down Expand Up @@ -1321,13 +1328,27 @@ main(int argc, char **argv)
gchar *oth_db_name = g_strconcat(tmp_out_repo, "/other.sqlite",
sqlite_compression_suffix, NULL);

cr_db_dbinfo_update(pri_db, pri_xml_rec->checksum, NULL);
cr_db_dbinfo_update(fil_db, fil_xml_rec->checksum, NULL);
cr_db_dbinfo_update(oth_db, oth_xml_rec->checksum, NULL);
cr_db_dbinfo_update(pri_db, pri_xml_rec->checksum, &tmp_err);
if (!tmp_err)
cr_db_dbinfo_update(fil_db, fil_xml_rec->checksum, &tmp_err);
if (!tmp_err)
cr_db_dbinfo_update(oth_db, oth_xml_rec->checksum, &tmp_err);
if (tmp_err) {
g_critical("Error updating dbinfo: %s", tmp_err->message);
g_clear_error(&tmp_err);
exit(EXIT_FAILURE);
}

cr_db_close(pri_db, NULL);
cr_db_close(fil_db, NULL);
cr_db_close(oth_db, NULL);
cr_db_close(pri_db, &tmp_err);
if (!tmp_err)
cr_db_close(fil_db, &tmp_err);
if (!tmp_err)
cr_db_close(oth_db, &tmp_err);
if (tmp_err) {
g_critical("Error while closing db: %s", tmp_err->message);
g_clear_error(&tmp_err);
exit(EXIT_FAILURE);
}


// Compress dbs
Expand Down

0 comments on commit aa36ceb

Please sign in to comment.