]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
rpmmd diskusage: prepend a '/' to the dir if not already there
authorMichael Schroeder <mls@suse.de>
Thu, 3 Mar 2016 11:59:18 +0000 (12:59 +0100)
committerMichael Schroeder <mls@suse.de>
Thu, 3 Mar 2016 11:59:18 +0000 (12:59 +0100)
Makes the code consistent with repo_susetags.

ext/repo_rpmmd.c

index 5ef5c25af33602982ba9e61b443b868e521ef1cf..78264cca57bb83e359535d66b4d3a79bae1c1b96 100644 (file)
@@ -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, "<dir .../> 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)