summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-09-03 13:15:10 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-09-03 13:15:10 +0000
commit330dc5511ae7c107e8c84833ea0887ced07c002b (patch)
tree73ab20662f1c2de5b588e00aab5fd2cdb2c42f22 /src
parent58e771303c95f9d97d009602516b509866c3fb5a (diff)
downloadapk-tools-330dc5511ae7c107e8c84833ea0887ced07c002b.tar.gz
apk-tools-330dc5511ae7c107e8c84833ea0887ced07c002b.tar.bz2
apk-tools-330dc5511ae7c107e8c84833ea0887ced07c002b.tar.xz
apk-tools-330dc5511ae7c107e8c84833ea0887ced07c002b.zip
index: do not segfault if there are no description
Diffstat (limited to 'src')
-rw-r--r--src/index.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/index.c b/src/index.c
index ac6a763..fffa739 100644
--- a/src/index.c
+++ b/src/index.c
@@ -173,11 +173,13 @@ static int index_main(void *ctx, struct apk_database *db, int argc, char **argv)
os = apk_ostream_gzip(os);
- memset(&fi, 0, sizeof(fi));
- fi.mode = 0644 | S_IFREG;
- fi.name = "DESCRIPTION";
- fi.size = strlen(ictx->description);
- apk_tar_write_entry(os, &fi, ictx->description);
+ if (ictx->description != NULL) {
+ memset(&fi, 0, sizeof(fi));
+ fi.mode = 0644 | S_IFREG;
+ fi.name = "DESCRIPTION";
+ fi.size = strlen(ictx->description);
+ apk_tar_write_entry(os, &fi, ictx->description);
+ }
memset(&fi, 0, sizeof(fi));
fi.mode = 0644 | S_IFREG;