]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Fix otherprovides() parsing
authorMichael Schroeder <mls@suse.de>
Wed, 25 Jan 2017 10:05:59 +0000 (11:05 +0100)
committerMichael Schroeder <mls@suse.de>
Wed, 25 Jan 2017 10:05:59 +0000 (11:05 +0100)
Do not search for the first '(', because the dependency
may contain it. Just remove the last character like with
the supplements.

src/suse.c

index 6106f3f8e63e685db9087790a37923f53f944a56..9537a336eb87815c1da4ecb3490299ac11407082 100644 (file)
@@ -211,7 +211,7 @@ repo_fix_supplements(Repo *repo, Offset provides, Offset supplements, Offset fre
 Offset
 repo_fix_conflicts(Repo *repo, Offset conflicts)
 {
-  char buf[1024], *p, *dep;
+  char buf[1024], *dep;
   Pool *pool = repo->pool;
   Id id;
   int i;
@@ -224,11 +224,10 @@ repo_fix_conflicts(Repo *repo, Offset conflicts)
       if (ISRELDEP(id))
        continue;
       dep = (char *)pool_id2str(pool, id);
-      if (!strncmp(dep, "otherproviders(", 15) && strlen(dep) < sizeof(buf) - 2)
+      if (!strncmp(dep, "otherproviders(", 15) && dep[15] && strlen(dep) < sizeof(buf) - 2)
        {
          strcpy(buf, dep + 15);
-         if ((p = strchr(buf, ')')) != 0)
-           *p = 0;
+         buf[strlen(buf) - 1] = 0;
          id = pool_str2id(pool, buf, 1);
          id = pool_rel2id(pool, NAMESPACE_OTHERPROVIDERS, id, REL_NAMESPACE, 1);
          repo->idarraydata[i] = id;