[Pkg-db-devel] Bug#343350: Cursors and DB_DBT_USERMEM
Florian Weimer
fw at deneb.enyo.de
Wed Dec 14 15:53:17 UTC 2005
Package: libdb4.4
Version: 4.4.16-1
Tags: patch upstream
If DBC->c_get is invoked with two DBTs with the DB_DBT_USERMEM flag,
and the flag is DB_NEXT, and the key DBT is too small, and the value
in the database is empty, DBC->c_get returns a DB_BUFFER_SMALL error
code *and* advances the cursor.
The attached patch from Sleepycat fixes this. Please apply. Thanks.
*** db/db_cam.c.orig 8 Dec 2005 19:37:44 -0000 12.23
--- db/db_cam.c 14 Dec 2005 01:34:51 -0000 12.24
***************
*** 830,843 ****
}
- if ((t_ret = __db_c_cleanup(dbc_arg, dbc_n, ret)) != 0 && ret == 0)
- ret = t_ret;
-
if (key_small) {
data->ulen = orig_ulen;
if (ret == 0)
ret = DB_BUFFER_SMALL;
}
if (flags == DB_CONSUME || flags == DB_CONSUME_WAIT)
CDB_LOCKING_DONE(dbp, dbc_arg);
--- 830,844 ----
}
if (key_small) {
data->ulen = orig_ulen;
if (ret == 0)
ret = DB_BUFFER_SMALL;
}
+
+ if ((t_ret = __db_c_cleanup(dbc_arg, dbc_n, ret)) != 0 &&
+ (ret == 0 || ret == DB_BUFFER_SMALL))
+ ret = t_ret;
if (flags == DB_CONSUME || flags == DB_CONSUME_WAIT)
CDB_LOCKING_DONE(dbp, dbc_arg);
More information about the Pkg-db-devel
mailing list