[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#7554) mdb_cursor_put() flag combinations broken



h.b.furuseth@usit.uio.no wrote:
> Full_Name: Hallvard B Furuseth
> Version: mdb.master bbb27cde4af7
> OS:
> URL:
> Submission from: (NULL) (193.69.163.163)
> Submitted by: hallvard
>
>
> mdb_cursor_put() and mdb_cursor_del() sometimes tests the
> flags argument with '==' or '!=' instead of '&'.  That breaks
> flag combinations like MDB_CURRENT | MDB_RESERVE:

The cursor_put flags are not combinable. The doc already says only one value 
may be set. Closing this ITS.
>
> grep -n 'flags [!=]= MDB_' mdb.c
> 4884:  if (flags != MDB_CURRENT && (key->mv_size == 0 || key->mv_size >
> MDB_MAXKEYSIZE))
> 4900:  if (flags == MDB_CURRENT) {
> 4962:      if (flags == MDB_CURRENT) {
> 4977:        if (flags == MDB_CURRENT)
> 4992:          return (flags == MDB_NODUPDATA) ? MDB_KEYEXIST : MDB_SUCCESS;
> 5025:        if (flags == MDB_CURRENT) {
> 5274:    if (flags != MDB_NODUPDATA) {
>
> The mdb_cursor_del() test is not a problem yet since only
> one flag is valid, but it'll become broken if more flags
> get supported.
>
>


-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/