summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-22 17:08:07 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-22 17:08:07 +0200
commita1d16c5d5d0cb86773346cda85b93c44ef876218 (patch)
treecaa66e78bf1d47f33e84294032bd81ca469c74b5 /src/database.c
parent77e203bf3224293d8f8e01dd15d6262eed840cf9 (diff)
downloadapk-tools-a1d16c5d5d0cb86773346cda85b93c44ef876218.tar.gz
apk-tools-a1d16c5d5d0cb86773346cda85b93c44ef876218.tar.bz2
apk-tools-a1d16c5d5d0cb86773346cda85b93c44ef876218.tar.xz
apk-tools-a1d16c5d5d0cb86773346cda85b93c44ef876218.zip
db: fix repositories.d to be loaded only without --repositories-file
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/database.c b/src/database.c
index 2d3142a..9da4815 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1420,9 +1420,13 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
list_for_each_entry(repo, &dbopts->repository_list, list)
apk_db_add_repository(db, APK_BLOB_STR(repo->url));
- add_repos_from_file(db, db->root_fd, dbopts->repositories_file ?: "etc/apk/repositories");
- apk_dir_foreach_file(openat(db->root_fd, "etc/apk/repositories.d", O_RDONLY | O_CLOEXEC),
- add_repos_from_file, db);
+ if (dbopts->repositories_file == NULL) {
+ add_repos_from_file(db, db->root_fd, "etc/apk/repositories");
+ apk_dir_foreach_file(openat(db->root_fd, "etc/apk/repositories.d", O_RDONLY | O_CLOEXEC),
+ add_repos_from_file, db);
+ } else {
+ add_repos_from_file(db, db->root_fd, dbopts->repositories_file);
+ }
if (apk_flags & APK_UPDATE_CACHE)
apk_db_index_write_nr_cache(db);