- be more carful in pool_addfileprovides
authorMichael Schroeder <mls@suse.de>
Thu, 10 Sep 2009 12:10:22 +0000 (14:10 +0200)
committerMichael Schroeder <mls@suse.de>
Thu, 10 Sep 2009 12:10:22 +0000 (14:10 +0200)
src/dirpool.c
src/pool.c
src/repodata.c

index 915e7bc..afccf50 100644 (file)
@@ -53,6 +53,8 @@ dirpool_add_dir(Dirpool *dp, Id parent, Id comp, int create)
 
   if (!dp->ndirs)
     {
+      if (!create)
+       return 0;
       dp->ndirs = 2;
       dp->dirs = sat_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK);
       dp->dirs[0] = 0;
index 21c52c2..dad0971 100644 (file)
@@ -900,7 +900,7 @@ addfileprovides_cb(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyV
            MAPSET(&cbd->useddirs, did);
        }
     }
-  if (!MAPTST(&cbd->useddirs, value->id))
+  if (value->id >= data->dirpool.ndirs || !MAPTST(&cbd->useddirs, value->id))
     return 0;
   for (i = 0; i < cbd->nfiles; i++)
     {
@@ -956,6 +956,7 @@ pool_addfileprovides_search(Pool *pool, struct addfileprovides_cbdata *cbd, stru
        {
          if (ndone >= repo->nsolvables)
            break;
+
          if (!repodata_precheck_keyname(data, SOLVABLE_FILELIST))
            continue;
          for (j = 1; j < data->nkeys; j++)
@@ -963,6 +964,7 @@ pool_addfileprovides_search(Pool *pool, struct addfileprovides_cbdata *cbd, stru
              break;
          if (j == data->nkeys)
            continue;
+
          if (repodata_lookup_idarray(data, SOLVID_META, REPOSITORY_ADDEDFILEPROVIDES, &fileprovidesq))
            {
              map_empty(&cbd->providedids);
index 512080b..8844ea7 100644 (file)
@@ -244,7 +244,7 @@ repodata_str2dir(Repodata *data, const char *dir, int create)
     {
       if (data->dirpool.ndirs)
         return 1;
-      return dirpool_add_dir(&data->dirpool, 0, 1, 1);
+      return dirpool_add_dir(&data->dirpool, 0, 1, create);
     }
   while (*dir)
     {