Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix multiple repo local read

  • Loading branch information...
commit 3a755a274c8b4ce66ab9ae9f3ec9dbe624d2e0ff 1 parent 8802376
Jari Vetoniemi authored June 06, 2012

Showing 1 changed file with 12 additions and 3 deletions. Show diff stats Hide diff stats

  1. 15  lib/database.c
15  lib/database.c
@@ -233,6 +233,7 @@ int _pndman_db_get(pndman_repository *repo, pndman_device *device)
233 233
    char appdata[PNDMAN_PATH];
234 234
    char *ret;
235 235
    int  parse = 0;
  236
+   pndman_repository *r, *rs;
236 237
    assert(device);
237 238
 
238 239
    /* find local db and read it first */
@@ -264,11 +265,19 @@ int _pndman_db_get(pndman_repository *repo, pndman_device *device)
264 265
       goto fail;
265 266
 
266 267
    /* read repository */
267  
-   memset(s,  0, LINE_MAX);
  268
+   rs = _pndman_repository_first(repo);
  269
+   memset(s, 0, LINE_MAX);
268 270
    snprintf(s2, LINE_MAX-1, "[%s]", repo->url);
269 271
    while ((ret = fgets(s, LINE_MAX, f))) {
270  
-      if (!parse && !(memcmp(s, s2, strlen(s2)))) parse = 1;
271  
-      else if (parse && strlen(s)) fprintf(f2, "%s", s);
  272
+      if (!parse && !memcmp(s, s2, strlen(s2))) parse = 1;
  273
+      else if (parse && strlen(s)) {
  274
+         for (r = rs; r && parse; r = r->next) {
  275
+            snprintf(s2, LINE_MAX-1, "[%s]", r->url);
  276
+            if (!memcmp(s, s2, strlen(s2))) parse = 0;
  277
+         }
  278
+         if (!parse) break;
  279
+         fprintf(f2, "%s", s);
  280
+      }
272 281
    }
273 282
 
274 283
    /* process and close */

0 notes on commit 3a755a2

Please sign in to comment.
Something went wrong with that request. Please try again.