From c03505b13eae74b2411e77f08c4bba6a1c71aed7 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 22 Jan 2014 11:53:08 +0100 Subject: [PATCH] Fix #30 (segment fault in xbps-rindex) --- NEWS | 2 ++ bin/xbps-rindex/index-clean.c | 2 +- lib/repo.c | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ca24c93d..c4810b8d 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ xbps-0.30 (??): + * Fixed issue #30: https://github.com/voidlinux/xbps/issues/30 + * Fixed issue #29: https://github.com/voidlinux/xbps/issues/29 * Fixed issue #28: https://github.com/voidlinux/xbps/issues/28 diff --git a/bin/xbps-rindex/index-clean.c b/bin/xbps-rindex/index-clean.c index e15dd0c7..ac2f0d9d 100644 --- a/bin/xbps-rindex/index-clean.c +++ b/bin/xbps-rindex/index-clean.c @@ -131,7 +131,7 @@ index_clean(struct xbps_handle *xhp, const char *repodir) idxfiles = xbps_dictionary_copy(repo->idxfiles); xbps_repo_close(repo); if (idx == NULL || idxfiles == NULL) { - fprintf(stderr, "incomplete repository data file!"); + fprintf(stderr, "incomplete repository data file!\n"); return -1; } printf("Cleaning `%s' index, please wait...\n", repodir); diff --git a/lib/repo.c b/lib/repo.c index e6fea96d..d3165d2a 100644 --- a/lib/repo.c +++ b/lib/repo.c @@ -65,6 +65,9 @@ repo_get_dict(struct xbps_repo *repo) size_t size; int rv; + if (repo->ar == NULL) + return NULL; + rv = archive_read_next_header(repo->ar, &entry); if (rv != ARCHIVE_OK) { xbps_dbg_printf(repo->xhp,