mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 17:19:43 -05:00
mdb_stat cleanup.
Exit with success when there was no failure. Do not use data containing NUL as a DB name (which is a C string).
This commit is contained in:
parent
a1b16ce5f0
commit
5ea1cd8f6d
1 changed files with 7 additions and 1 deletions
|
|
@ -194,8 +194,11 @@ int main(int argc, char *argv[])
|
|||
goto txn_abort;
|
||||
}
|
||||
while ((rc = mdb_cursor_get(cursor, &key, NULL, MDB_NEXT_NODUP)) == 0) {
|
||||
char *str = malloc(key.mv_size+1);
|
||||
char *str;
|
||||
MDB_dbi db2;
|
||||
if (memchr(key.mv_data, '\0', key.mv_size))
|
||||
continue;
|
||||
str = malloc(key.mv_size+1);
|
||||
memcpy(str, key.mv_data, key.mv_size);
|
||||
str[key.mv_size] = '\0';
|
||||
rc = mdb_open(txn, str, 0, &db2);
|
||||
|
|
@ -214,6 +217,9 @@ int main(int argc, char *argv[])
|
|||
mdb_cursor_close(cursor);
|
||||
}
|
||||
|
||||
if (rc == MDB_NOTFOUND)
|
||||
rc = MDB_SUCCESS;
|
||||
|
||||
mdb_close(env, dbi);
|
||||
txn_abort:
|
||||
mdb_txn_abort(txn);
|
||||
|
|
|
|||
Loading…
Reference in a new issue