From 447b194b26eb741ebb7fca942ef79d3a2ba3c91d Mon Sep 17 00:00:00 2001 From: Timo Teräs 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/package.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/package.c') diff --git a/src/package.c b/src/package.c index 9ad17e9..ecf88c2 100644 --- a/src/package.c +++ b/src/package.c @@ -1156,15 +1156,18 @@ int apk_pkg_write_index_entry(struct apk_package *info, } apk_blob_push_blob(&bbuf, APK_BLOB_STR("\n")); - if (APK_BLOB_IS_NULL(bbuf)) - return -1; + if (APK_BLOB_IS_NULL(bbuf)) { + apk_error("Metadata for package " PKG_VER_FMT " is too long.", + PKG_VER_PRINTF(info)); + return -ENOBUFS; + } bbuf = apk_blob_pushed(APK_BLOB_BUF(buf), bbuf); if (os->write(os, bbuf.ptr, bbuf.len) != bbuf.len || write_depends(os, "D:", info->depends) || write_depends(os, "p:", info->provides) || write_depends(os, "i:", info->install_if)) - return -1; + return -EIO; return 0; } -- cgit v1.2.3-70-g09d2