diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-07-23 11:35:40 +0300 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-07-23 11:35:40 +0300 |
commit | a388f4bfa6e92a06d95de576aee94f2ae5695cfe (patch) | |
tree | a9c6266888ab79be0c49715efabec769802816fa /src/database.c | |
parent | 90aaa28a95f28206e6bf4ed0d5a798595165cb8c (diff) | |
download | apk-tools-a388f4bfa6e92a06d95de576aee94f2ae5695cfe.tar.gz apk-tools-a388f4bfa6e92a06d95de576aee94f2ae5695cfe.tar.bz2 apk-tools-a388f4bfa6e92a06d95de576aee94f2ae5695cfe.tar.xz apk-tools-a388f4bfa6e92a06d95de576aee94f2ae5695cfe.zip |
index: more informative error message
when failed to load an existing index.
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/database.c b/src/database.c index 719a445..076f72f 100644 --- a/src/database.c +++ b/src/database.c @@ -1165,12 +1165,14 @@ static int load_apkindex(void *sctx, const struct apk_file_info *fi, apk_db_index_read(ctx->db, bs, ctx->repo); bs->close(bs, NULL); - return 0; + return -ECANCELED; } static int load_index(struct apk_database *db, struct apk_bstream *bs, int targz, int repo) { + int r = 0; + if (targz) { struct apk_istream *is; struct apkindex_ctx ctx; @@ -1179,17 +1181,19 @@ static int load_index(struct apk_database *db, struct apk_bstream *bs, ctx.repo = repo; apk_sign_ctx_init(&ctx.sctx, APK_SIGN_VERIFY, NULL); is = apk_bstream_gunzip_mpart(bs, apk_sign_ctx_mpart_cb, &ctx.sctx); - apk_tar_parse(is, load_apkindex, &ctx); + r = apk_tar_parse(is, load_apkindex, &ctx); is->close(is); apk_sign_ctx_free(&ctx.sctx); - if (!ctx.sctx.data_verified) - return -1; + if (r == 0) + r = -ENOMSG; + else if (r == -ECANCELED) + r = 0; } else { bs = apk_bstream_from_istream(apk_bstream_gunzip(bs)); apk_db_index_read(db, bs, repo); bs->close(bs, NULL); } - return 0; + return r; } int apk_db_index_read_file(struct apk_database *db, const char *file, int repo) |