mdbx: backport - fix mdbx_set_attr().

Change-Id: I6628a0629a17f99f39098b8ccb76259cd65dd353
This commit is contained in:
Leo Yuriev 2017-07-23 14:16:19 +03:00
parent 6760ca87ae
commit 4874852b79

3
mdbx.c
View File

@ -864,13 +864,14 @@ int mdbx_set_attr(MDB_txn *txn, MDB_dbi dbi,
return rc; return rc;
} }
old_attr = 0;
rc = mdbx_attr_peek(&old_data, &old_attr); rc = mdbx_attr_peek(&old_data, &old_attr);
if (unlikely(rc != MDB_SUCCESS)) if (unlikely(rc != MDB_SUCCESS))
return rc; return rc;
if (old_attr == attr && (!data || if (old_attr == attr && (!data ||
(data->mv_size == old_data.mv_size (data->mv_size == old_data.mv_size
&& memcpy(data->mv_data, old_data.mv_data, old_data.mv_size) == 0))) && memcmp(data->mv_data, old_data.mv_data, old_data.mv_size) == 0)))
return MDB_SUCCESS; return MDB_SUCCESS;
mc.mc_next = txn->mt_cursors[dbi]; mc.mc_next = txn->mt_cursors[dbi];