From: Jo-Philipp Wich Date: Wed, 22 Feb 2017 12:27:20 +0000 (+0100) Subject: libopkg: initialize conffile list during status parsing X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=271d485c10f2070573b25e740b93839945dbcd9d;p=oweals%2Fopkg-lede.git libopkg: initialize conffile list during status parsing When parsing conffile information from status files, we need to initialize the conffile list head upon encountering a "Conffiles:" line, otherwise parse_conffiles() will ignore all subsequent entries due to a missing list pointer. Fixes missing conffile information in /usr/lib/opkg/status on a fresh installation. Reported-by: Hartmut Birr Signed-off-by: Jo-Philipp Wich --- diff --git a/libopkg/pkg_parse.c b/libopkg/pkg_parse.c index 7f46dc5..7017a06 100644 --- a/libopkg/pkg_parse.c +++ b/libopkg/pkg_parse.c @@ -116,6 +116,7 @@ int pkg_parse_line(void *ptr, const char *line, uint mask) { pkg_t *pkg = (pkg_t *) ptr; abstract_pkg_t *ab_pkg = NULL; + conffile_list_t *cl; /* these flags are a bit hackish... */ static int reading_conffiles = 0, reading_description = 0; @@ -146,6 +147,11 @@ int pkg_parse_line(void *ptr, const char *line, uint mask) if ((mask & PFM_CONFFILES) && is_field("Conffiles", line)) { reading_conffiles = 1; reading_description = 0; + + cl = xcalloc(1, sizeof(*cl)); + conffile_list_init(cl); + pkg_set_ptr(pkg, PKG_CONFFILES, cl); + goto dont_reset_flags; } else if ((mask & PFM_CONFLICTS) && is_field("Conflicts", line))