rules/selection: use strrchr in EVR checks as well
[platform/upstream/libsolv.git] / src / selection.c
index 8fc1998..df09b5f 100644 (file)
@@ -218,7 +218,7 @@ selection_filter_rel(Pool *pool, Queue *selection, Id relflags, Id relevr)
             selection->elements[i] |= SOLVER_SETEVR;   /* debian can't match version only like rpm */
          else
            {
-             const char *rel =  strchr(pool_id2str(pool, relevr), '-');
+             const char *rel =  strrchr(pool_id2str(pool, relevr), '-');
              if (rel && pool->disttype == DISTTYPE_HAIKU && (rel[1] < '0' || rel[1] > '9'))
                rel = 0;
              selection->elements[i] |= rel ? SOLVER_SETEVR : SOLVER_SETEV;
@@ -686,7 +686,7 @@ selection_canon(Pool *pool, Queue *selection, const char *name, int flags)
          return 0;
        }
       /* is there a vaild arch? */
-      if ((r2 = strchr(r, '_')) != 0 && r[1] && (archid = str2archid(pool, r + 1)) != 0)
+      if ((r2 = strrchr(r, '_')) != 0 && r[1] && (archid = str2archid(pool, r + 1)) != 0)
        {
          *r2 = 0;      /* split off */
           selection_filter_rel(pool, selection, REL_ARCH, archid);
@@ -709,7 +709,7 @@ selection_canon(Pool *pool, Queue *selection, const char *name, int flags)
          return 0;
        }
       /* is there a vaild arch? */
-      if ((r2 = strchr(r, '-')) != 0 && r[1] && (archid = str2archid(pool, r + 1)) != 0)
+      if ((r2 = strrchr(r, '-')) != 0 && r[1] && (archid = str2archid(pool, r + 1)) != 0)
        {
          *r2 = 0;      /* split off */
           selection_filter_rel(pool, selection, REL_ARCH, archid);