diff options
author | Timo Teräs <timo.teras@iki.fi> | 2022-04-05 10:31:20 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2022-06-03 14:27:20 +0300 |
commit | 1be0510c4e2dc806e5989d49884f5a626b132ec4 (patch) | |
tree | c78faf39cd4dd71eca856e1a907b79db57ab48f9 | |
parent | fe0a16a1869f090c9d9eeaad21848ef39c0a35ad (diff) | |
download | apk-tools-1be0510c4e2dc806e5989d49884f5a626b132ec4.tar.gz apk-tools-1be0510c4e2dc806e5989d49884f5a626b132ec4.tar.bz2 apk-tools-1be0510c4e2dc806e5989d49884f5a626b132ec4.tar.xz apk-tools-1be0510c4e2dc806e5989d49884f5a626b132ec4.zip |
db: fix atfd for access repository index
fixes #10834
-rw-r--r-- | src/database.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/database.c b/src/database.c index 888033f..1a423dc 100644 --- a/src/database.c +++ b/src/database.c @@ -2259,7 +2259,7 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t _repository) struct apk_repository *repo; struct apk_url_print urlp; apk_blob_t brepo, btag; - int repo_num, r, targz = 1, tag_id = 0; + int repo_num, r, tag_id = 0, atfd = AT_FDCWD; char buf[PATH_MAX], *url; brepo = _repository; @@ -2305,6 +2305,7 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t _repository) } else { if (db->autoupdate) apk_repository_update(db, repo); r = apk_repo_format_cache_index(APK_BLOB_BUF(buf), repo); + atfd = db->cache_fd; } } else { db->local_repos |= BIT(repo_num); @@ -2312,7 +2313,7 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t _repository) r = apk_repo_format_real_url(db->arch, repo, NULL, buf, sizeof(buf), &urlp); } if (r == 0) { - r = load_index(db, apk_istream_from_fd_url(db->cache_fd, buf), targz, repo_num); + r = load_index(db, apk_istream_from_fd_url(atfd, buf), 1, repo_num); } if (r != 0) { |