diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-05-30 10:22:35 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-05-30 10:22:35 +0300 |
commit | 447b194b26eb741ebb7fca942ef79d3a2ba3c91d (patch) | |
tree | 966fce86e07ad0aba64ea1b241ccbf8bca12dbf5 /src/database.c | |
parent | aec93ee730f7a2e0196ae05fdd45e866d2510e41 (diff) | |
download | apk-tools-447b194b26eb741ebb7fca942ef79d3a2ba3c91d.tar.gz apk-tools-447b194b26eb741ebb7fca942ef79d3a2ba3c91d.tar.bz2 apk-tools-447b194b26eb741ebb7fca942ef79d3a2ba3c91d.tar.xz apk-tools-447b194b26eb741ebb7fca942ef79d3a2ba3c91d.zip |
index: add sensible error message if metadata is too long
fixes #1476
Instead of:
ERROR: Index generation failed: Success
The following is now printed:
ERROR: Metadata for package timo-1.0-r0 is too long.
ERROR: Index generation failed: No buffer space available
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/database.c b/src/database.c index 61e719d..0b40273 100644 --- a/src/database.c +++ b/src/database.c @@ -874,11 +874,11 @@ static int apk_db_write_fdb(struct apk_database *db, struct apk_ostream *os) apk_blob_push_blob(&bbuf, APK_BLOB_STR("\n")); if (os->write(os, buf, bbuf.ptr - buf) != bbuf.ptr - buf) - return -1; + return -EIO; bbuf = APK_BLOB_BUF(buf); } if (os->write(os, buf, bbuf.ptr - buf) != bbuf.ptr - buf) - return -1; + return -EIO; bbuf = APK_BLOB_BUF(buf); } os->write(os, "\n", 1); @@ -1101,7 +1101,7 @@ static int write_index_entry(apk_hash_item item, void *ctx) return r; if (iwctx->os->write(iwctx->os, "\n", 1) != 1) - return -1; + return -EIO; iwctx->count++; return 0; @@ -1124,7 +1124,7 @@ static int apk_db_index_write_nr_cache(struct apk_database *db) "installed.new", 0644); if (os == NULL) - return -1; + return -EIO; ctx.os = os; list_for_each_entry(ipkg, &db->installed.packages, installed_pkgs_list) { |