summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2016-12-03 01:51:09 +0100
committerMagnus Ahltorp <map@kth.se>2016-12-03 01:51:09 +0100
commit633b367b0c9e219a81b692223981a9329b5825f9 (patch)
tree1ce70b7fd46bd5ed58bc843c5f2f78d787bde60f
parent47c8ae43bf83b73d16257784e8afc957175489c0 (diff)
Only require complete permdb data file in r/w mode
-rw-r--r--c_src/permdb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/c_src/permdb.c b/c_src/permdb.c
index 0ce74b6..b5784d5 100644
--- a/c_src/permdb.c
+++ b/c_src/permdb.c
@@ -586,8 +586,10 @@ permdb_alloc(const char *dbpath, int lock)
}
if (datafile_verify_file(state->datafile) < 0) {
warnx("data file verification failed: %s", dbpath);
- permdb_free(state);
- return NULL;
+ if (state->write_enabled) {
+ permdb_free(state);
+ return NULL;
+ }
}
if (indexfile_verify_file(state->indexfile) < 0) {
if (!state->write_enabled) {