summaryrefslogtreecommitdiff
path: root/src/package.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-06-28 15:40:52 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-06-28 15:40:52 +0300
commit433da92e374d8924abda3b78b6652971870b9697 (patch)
treecf834bbab98f83fd3c98ea17937368e74c22b173 /src/package.c
parent95555ede4d732878d576415e5d338b0104b78ad6 (diff)
downloadapk-tools-433da92e374d8924abda3b78b6652971870b9697.tar.gz
apk-tools-433da92e374d8924abda3b78b6652971870b9697.tar.bz2
apk-tools-433da92e374d8924abda3b78b6652971870b9697.tar.xz
apk-tools-433da92e374d8924abda3b78b6652971870b9697.zip
index: handle errors instead of silently failing
Make indexer keep noise about errors that prevent index generation. Detect certain errors in the APKs better. And also have the applet return error in these scenarios.
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/package.c b/src/package.c
index 2699420..28e091b 100644
--- a/src/package.c
+++ b/src/package.c
@@ -424,6 +424,12 @@ int apk_sign_ctx_process_file(struct apk_sign_ctx *ctx,
return 1;
if (fi->name[0] != '.' || strchr(fi->name, '/') != NULL) {
+ /* APKv1.0 compatibility - first non-hidden file is
+ * considered to start the data section of the file.
+ * This does not make any sense if the file has v2.0
+ * style .PKGINFO */
+ if (ctx->has_data_checksum)
+ return -ENOMSG;
ctx->data_started = 1;
ctx->control_started = 1;
return 1;
@@ -502,9 +508,11 @@ int apk_sign_ctx_verify_tar(void *sctx, const struct apk_file_info *fi,
struct apk_istream *is)
{
struct apk_sign_ctx *ctx = (struct apk_sign_ctx *) sctx;
+ int r;
- if (apk_sign_ctx_process_file(ctx, fi, is) == 0)
- return 0;
+ r = apk_sign_ctx_process_file(ctx, fi, is);
+ if (r <= 0)
+ return r;
if (strcmp(fi->name, ".PKGINFO") == 0) {
apk_blob_t blob = apk_blob_from_istream(is, fi->size);
@@ -734,10 +742,12 @@ static int read_info_entry(void *ctx, const struct apk_file_info *ae,
{
struct read_info_ctx *ri = (struct read_info_ctx *) ctx;
struct apk_package *pkg = ri->pkg;
+ int r;
/* Meta info and scripts */
- if (apk_sign_ctx_process_file(ri->sctx, ae, is) == 0)
- return 0;
+ r = apk_sign_ctx_process_file(ri->sctx, ae, is);
+ if (r <= 0)
+ return r;
if (ae->name[0] == '.') {
/* APK 2.0 format */