]> git.saurik.com Git - apt.git/commitdiff
* ftparchive/cachedb.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Mon, 24 Jul 2006 21:06:16 +0000 (23:06 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Mon, 24 Jul 2006 21:06:16 +0000 (23:06 +0200)
  - applied patch from ajt (#379576)

debian/changelog
ftparchive/cachedb.cc

index 1febfe4951526fe8ec8d86fde641efb0442b1f55..1cafdaa9009348a1bdae48f09ed13ce7ddfb1105 100644 (file)
@@ -2,6 +2,9 @@ apt (0.6.45) unstable; urgency=low
 
   * apt-pkg/contrib/sha256.cc:
     - fixed the sha256 generation (closes: #378183)
+  * ftparchive/cachedb.cc:
+    - applied patch from ajt to fix Clean() function
+      (closes: #379576)
 
  --
 
index 0e6078642ad4833b6aa4bb200096774032389e33..8a4ca023669361e32d23b25a8638be551a77c03d 100644 (file)
@@ -453,15 +453,14 @@ bool CacheDB::Clean()
    memset(&Data,0,sizeof(Data));
    while ((errno = Cursor->c_get(Cursor,&Key,&Data,DB_NEXT)) == 0)
    {
-      const char *Colon = (char *)Key.data;
-      for (; Colon != (char *)Key.data+Key.size && *Colon != ':'; Colon++);
-      if ((char *)Key.data+Key.size - Colon > 2)
+      const char *Colon = (char*)memrchr(Key.data, ':', Key.size);
+      if (Colon)
       {
-        if (stringcmp((char *)Key.data,Colon,"st") == 0 ||
-            stringcmp((char *)Key.data,Colon,"cn") == 0 ||
-            stringcmp((char *)Key.data,Colon,"cl") == 0)
+         if (stringcmp(Colon + 1, (char *)Key.data+Key.size,"st") == 0 ||
+             stringcmp(Colon + 1, (char *)Key.data+Key.size,"cl") == 0 ||
+             stringcmp(Colon + 1, (char *)Key.data+Key.size,"cn") == 0)
         {
-           if (FileExists(string(Colon+1,(const char *)Key.data+Key.size)) == true)
+            if (FileExists(string((const char *)Key.data,Colon)) == true)
                continue;            
         }
       }