Should this be testing rc != MDB_SUCCESS ?
I understand that may be the same thing if MDB_SUCCESS is 0, but it'd make the code clearer, given the other references to MDB_SUCCESS.