diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app_index.c | 34 | ||||
-rw-r--r-- | src/database.c | 4 |
2 files changed, 17 insertions, 21 deletions
diff --git a/src/app_index.c b/src/app_index.c index 80fd8e2..7281565 100644 --- a/src/app_index.c +++ b/src/app_index.c @@ -265,31 +265,29 @@ static int index_main(void *ctx, struct apk_database *db, struct apk_string_arra fi.mode = 0644 | S_IFREG; fi.name = "APKINDEX"; counter = apk_ostream_counter(&fi.size); - r = index_write(ictx, db, counter); + index_write(ictx, db, counter); apk_ostream_close(counter); - if (r >= 0) { - os = apk_ostream_gzip(os); - if (ictx->description != NULL) { - struct apk_file_info fi_desc; - memset(&fi_desc, 0, sizeof(fi)); - fi_desc.mode = 0644 | S_IFREG; - fi_desc.name = "DESCRIPTION"; - fi_desc.size = strlen(ictx->description); - apk_tar_write_entry(os, &fi_desc, ictx->description); - } + os = apk_ostream_gzip(os); + if (ictx->description) { + struct apk_file_info fi_desc; + memset(&fi_desc, 0, sizeof(fi)); + fi_desc.mode = 0644 | S_IFREG; + fi_desc.name = "DESCRIPTION"; + fi_desc.size = strlen(ictx->description); + apk_tar_write_entry(os, &fi_desc, ictx->description); + } - apk_tar_write_entry(os, &fi, NULL); - r = index_write(ictx, db, os); - apk_tar_write_padding(os, &fi); + apk_tar_write_entry(os, &fi, NULL); + index_write(ictx, db, os); + apk_tar_write_padding(os, &fi); - apk_tar_write_entry(os, NULL, NULL); - } + apk_tar_write_entry(os, NULL, NULL); } else { - r = index_write(ictx, db, os); + index_write(ictx, db, os); } - apk_ostream_close(os); + r = apk_ostream_close(os); if (r < 0) { apk_error("Index generation failed: %s", apk_error_str(r)); return r; diff --git a/src/database.c b/src/database.c index ba53ecb..da77b07 100644 --- a/src/database.c +++ b/src/database.c @@ -1208,7 +1208,6 @@ static int apk_db_index_write_nr_cache(struct apk_database *db) struct apk_package_array *pkgs; struct apk_package **ppkg; struct apk_ostream *os; - int r; if (!apk_db_cache_active(db)) return 0; @@ -1225,8 +1224,7 @@ static int apk_db_index_write_nr_cache(struct apk_database *db) struct apk_package *pkg = *ppkg; if ((pkg->repos == BIT(APK_REPOSITORY_CACHED) || (pkg->repos == 0 && !pkg->installed_size))) { - r = apk_pkg_write_index_entry(pkg, os); - if (r != 0) return r; + if (apk_pkg_write_index_entry(pkg, os) < 0) break; } } return apk_ostream_close(os); |