apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mladen Turk" <mt...@mappingsoft.com>
Subject [PATCH] apr_dbm -- db fix
Date Mon, 17 Sep 2001 18:44:31 GMT
Hi,
Small patch to fix the APU_USE_DB that causes wrong apr_dbm_nextkey reading.
DB->seq returns RET_SPECIAL when the cursor passes last record so...
infinite loop.


Index: apr_dbm.c
===================================================================
RCS file: /home/cvspublic/apr-util/dbm/apr_dbm.c,v
retrieving revision 1.27
diff -u -r1.27 apr_dbm.c
--- apr_dbm.c	2001/08/29 18:34:05	1.27
+++ apr_dbm.c	2001/09/17 18:25:58
@@ -257,6 +257,10 @@

 #if DB_VER == 1
     dberr = (*f->bdb->seq)(f->bdb, pkey, &data, R_NEXT);
+    if (dberr == RET_SPECIAL) {
+        pkey->data = NULL;
+        pkey->size = 0;
+    }
 #else
     if (f->curs == NULL)
         return APR_EINVAL;
@@ -553,7 +557,7 @@

     CONVERT_DATUM(ckey, pkey);
     rv = APR_DBM_NEXTKEY(dbm->file, ckey, rd);
-    RETURN_DATUM(pkey, rd);
+    RETURN_DATUM(pkey, ckey);

     REGISTER_CLEANUP(dbm, pkey);


MT.


Mime
View raw message