poldek: poldek/pkgdir/pkgdir_dirindex.c - do not create empty diri...

mis mis at pld-linux.org
Tue Aug 22 17:12:51 CEST 2006


Author: mis                          Date: Tue Aug 22 15:12:51 2006 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- do not create empty dirindexes (fixes 'tndb create failed' bug)

---- Files affected:
poldek/poldek/pkgdir:
   pkgdir_dirindex.c (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: poldek/poldek/pkgdir/pkgdir_dirindex.c
diff -u poldek/poldek/pkgdir/pkgdir_dirindex.c:1.4 poldek/poldek/pkgdir/pkgdir_dirindex.c:1.5
--- poldek/poldek/pkgdir/pkgdir_dirindex.c:1.4	Mon Aug 21 13:19:45 2006
+++ poldek/poldek/pkgdir/pkgdir_dirindex.c	Tue Aug 22 17:12:46 2006
@@ -215,6 +215,9 @@
     struct vflock *lock;
     int           i;
     char          *tmp, *dir;
+
+    if (n_array_size(pkgdir->pkgs) == 0)
+        return 1;
     
     MEMINF("START");
 
@@ -342,7 +345,7 @@
 {
     struct tndb_it  it;
     char            key[TNDB_KEY_MAX + 1], *val = NULL;
-    int             nerr = 0, klen, vlen, vlen_max;
+    unsigned        nerr = 0, klen, vlen, vlen_max;
     tn_alloc        *na;
     tn_hash         *keymap;
 
@@ -409,13 +412,15 @@
     tn_hash         *idmap, *keymap;
     struct pkgdir_dirindex *dirindex = NULL;
 
+    if (n_array_size(pkgdir->pkgs) == 0)
+        return NULL;
     
     dirindex_path(path, sizeof(path), pkgdir);
     msgn(2, "Opening directory index of %s", pkgdir_idstr(pkgdir));
     MEMINF("start");
     
     if ((db = tndb_open(path)) == NULL) {
-        logn(LOGERR, "%s: tndb create failed", path);
+        logn(LOGERR, "%s: open failed", path);
         return NULL;
     }
 
@@ -540,10 +545,10 @@
                            tn_array **pkgs_ptr, const struct pkg *pkg,
                            const char *path)
 {
-    const char  **tl, **tl_save;
-    tn_array    *pkgs = NULL;
-    char        val[8192];
-    int         n, found;
+    const char    **tl, **tl_save;
+    tn_array      *pkgs = NULL;
+    unsigned char val[8192];
+    int           n, found;
     
 #if DEVEL    
     static int  xx = 0;
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/pkgdir/pkgdir_dirindex.c?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list