summaryrefslogtreecommitdiff
path: root/src/package.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-05-30 10:22:35 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-05-30 10:22:35 +0300
commit447b194b26eb741ebb7fca942ef79d3a2ba3c91d (patch)
tree966fce86e07ad0aba64ea1b241ccbf8bca12dbf5 /src/package.c
parentaec93ee730f7a2e0196ae05fdd45e866d2510e41 (diff)
downloadapk-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/package.c')
-rw-r--r--src/package.c9
1 files changed, 6 insertions, 3 deletions
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;
}