projects
/
platform
/
upstream
/
lmdb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a1b16ce
)
mdb_stat cleanup.
author
Hallvard Furuseth
<hallvard@openldap.org>
Tue, 21 May 2013 21:48:27 +0000
(23:48 +0200)
committer
Hallvard Furuseth
<hallvard@openldap.org>
Tue, 21 May 2013 21:48:27 +0000
(23:48 +0200)
Exit with success when there was no failure.
Do not use data containing NUL as a DB name (which is a C string).
libraries/liblmdb/mdb_stat.c
patch
|
blob
|
history
diff --git
a/libraries/liblmdb/mdb_stat.c
b/libraries/liblmdb/mdb_stat.c
index
ca6ad63
..
3e6be21
100644
(file)
--- a/
libraries/liblmdb/mdb_stat.c
+++ b/
libraries/liblmdb/mdb_stat.c
@@
-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);