*** db/db_am.c.orig Wed Dec 31 19:00:00 1969 --- db/db_am.c Sat Jan 2 15:46:42 1999 *************** *** 347,352 **** --- 347,353 ---- u_int32_t flags; { DBC *dbc; + DBT tdata; int ret, t_ret; DB_PANIC_CHECK(dbp); *************** *** 360,369 **** DEBUG_LWRITE(dbc, txn, "__db_put", key, data, flags); ! if (flags == DB_NOOVERWRITE && ! (ret = dbc->c_get(dbc, key, data, DB_SET | DB_RMW)) == 0) ! ret = DB_KEYEXIST; ! else ret = dbc->c_put(dbc, key, data, DB_KEYLAST); if ((t_ret = __db_c_close(dbc)) != 0 && ret == 0) --- 361,380 ---- DEBUG_LWRITE(dbc, txn, "__db_put", key, data, flags); ! if (flags == DB_NOOVERWRITE) { ! /* ! * Set DB_DBT_USERMEM, this might be a threaded application and ! * the flags checking will catch us. We don't want the actual ! * data, so request a partial of length 0. ! */ ! memset(&tdata, 0, sizeof(tdata)); ! F_SET(&tdata, DB_DBT_USERMEM | DB_DBT_PARTIAL); ! if ((ret = dbc->c_get(dbc, key, &tdata, DB_SET | DB_RMW)) == 0) ! ret = DB_KEYEXIST; ! else ! ret = 0; ! } ! if (ret == 0) ret = dbc->c_put(dbc, key, data, DB_KEYLAST); if ((t_ret = __db_c_close(dbc)) != 0 && ret == 0)