> -----Original Message-----
> From: Greg Stein [mailto:[EMAIL PROTECTED]
> Sent: 18. rujan 2001 03:44
> To: Mladen Turk
> Cc: 'APR Dev List'
> Subject: Re: [PATCH] apr_dbm -- db fix
>
> On Tue, Sep 18, 2001 at 10:05:07AM -0700, Mladen Turk wrote:
> > > -----Original Message-----
> > [Mladen Turk]
> > Sorry but did you try to run the testdbm utility?
>
> With the SDBM database... yup. All the time.
>
> That was my point -- the code dealing with RETURN_DATUM is correct.
The
> whole point of "result_datum_t" and the "rd" variable is to *return*
> values.
> Thus, the change to return a value via ckey is just wrong.
[Mladen Turk]
Mea culpa! Didn't switch back to SDBM to test the patch.
> Fine. That just says the DB portion is wrong, and do_nextkey() needs
to be
> fixed. The apr_dbm_nextkey() function shouldn't change.
> Thus: my veto stands against any modification to apr_dbm_nextkey().
Please
> make your fixes in do_nextkey().
[Mladen Turk]
No problemo...
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/18 10:56:31
@@ -253,22 +253,26 @@
static apr_status_t do_nextkey(real_file_t *f, DBT *pkey, DBT *pnext)
{
int dberr;
- DBT data;
+ DBT data = {0};
+ memset(pnext,0,sizeof(DBT));
#if DB_VER == 1
dberr = (*f->bdb->seq)(f->bdb, pkey, &data, R_NEXT);
+ if (dberr == RET_SPECIAL)
+ return APR_SUCCESS;
#else
if (f->curs == NULL)
return APR_EINVAL;
dberr = (*f->curs->c_get)(f->curs, pkey, &data, DB_NEXT);
if (dberr == DB_NOTFOUND) {
- memset(pkey, 0, sizeof(*pkey));
(*f->curs->c_close)(f->curs);
f->curs = NULL;
return APR_SUCCESS;
}
#endif
+ pnext->data = pkey->data;
+ pnext->size = pkey->size;
return db2s(dberr);
}