From 447b194b26eb741ebb7fca942ef79d3a2ba3c91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Thu, 30 May 2013 10:22:35 +0300 Subject: 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 --- src/database.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/database.c') 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) { -- cgit v1.2.3