ensure Pool and Repo are consistent
authorKlaus Kaempf <kkaempf@suse.de>
Tue, 21 Oct 2008 07:13:30 +0000 (07:13 +0000)
committerKlaus Kaempf <kkaempf@suse.de>
Tue, 21 Oct 2008 07:13:30 +0000 (07:13 +0000)
src/repodata.c

index 8e2c88b..71cd5cb 100644 (file)
@@ -952,11 +952,28 @@ enum {
   di_entersolvablekey
 };
 
+/* see repo.h for documentation */
 int
 dataiterator_init(Dataiterator *di, Pool *pool, Repo *repo, Id p, Id keyname, const char *match, int flags)
 {
   memset(di, 0, sizeof(*di));
   di->pool = pool;
+  if (!pool)
+    {
+      fprintf(stderr, "dataiterator_init: no Pool given\n");
+      di->state = di_bye;
+      return -1;
+    }
+  if (repo)
+    {
+      if (repo->pool != pool)
+       {
+         fprintf(stderr, "dataiterator_init: repo from different pool\n");
+         di->state = di_bye;
+         return -1;
+       }
+      
+    }
   if (match)
     {
       int error;