apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: [PATCH] apr_dbm -- db fix
Date Mon, 17 Sep 2001 20:57:19 GMT
-1 -- this patch should not be applied.

The change to RETURN_DATUM is wrong. The result of the NEXTKEY is placed
into "rd", and that is returned. If DB's do_nextkey is putting the result
into *pkey rather than *pnext, then *that* is the bug. But changing the
RETURN_DATUM call is wrong.

I *know* that the apr_dbm_nextkey() function is working. If DB isn't, then
you should question the macros instead.

Cheers,
-g

On Mon, Sep 17, 2001 at 08:44:31PM +0200, Mladen Turk wrote:
> 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.

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message