From: Michael Schroeder Date: Thu, 3 Mar 2016 11:59:18 +0000 (+0100) Subject: rpmmd diskusage: prepend a '/' to the dir if not already there X-Git-Tag: 0.6.20~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5218114520e47f50bef59606d32d9434ee4b6f47;p=thirdparty%2Flibsolv.git rpmmd diskusage: prepend a '/' to the dir if not already there Makes the code consistent with repo_susetags. --- diff --git a/ext/repo_rpmmd.c b/ext/repo_rpmmd.c index 5ef5c25a..78264cca 100644 --- a/ext/repo_rpmmd.c +++ b/ext/repo_rpmmd.c @@ -1014,15 +1014,24 @@ startElement(void *userData, const char *name, const char **atts) { long filesz = 0, filenum = 0; Id dirid; - if ((str = find_attr("name", atts)) != 0) - dirid = repodata_str2dir(pd->data, str, 1); - else - { + if ((str = find_attr("name", atts)) == 0) + { pd->ret = pool_error(pool, -1, " tag without 'name' attribute"); break; - } - if (!dirid) - dirid = repodata_str2dir(pd->data, "/", 1); + } + if (*str != '/') + { + int l = strlen(str) + 2; + if (l > pd->acontent) + { + pd->content = solv_realloc(pd->content, l + 256); + pd->acontent = l + 256; + } + *pd->content = '/'; + strcpy(pd->content + 1, str); + str = pd->content; + } + dirid = repodata_str2dir(pd->data, str, 1); if ((str = find_attr("size", atts)) != 0) filesz = strtol(str, 0, 0); if ((str = find_attr("count", atts)) != 0)