summaryrefslogtreecommitdiff
path: root/src/rdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rdb.c')
-rw-r--r--src/rdb.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/rdb.c b/src/rdb.c
index 6d29f80ce..300d15602 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -43,11 +43,20 @@
#define rdbExitReportCorruptRDB(reason) rdbCheckThenExit(reason, __LINE__);
+extern int rdbCheckMode;
+void rdbCheckError(const char *fmt, ...);
+
void rdbCheckThenExit(char *reason, int where) {
- serverLog(LL_WARNING, "Corrupt RDB detected at rdb.c:%d (%s). "
- "Running 'redis-check-rdb %s'",
- where, reason, server.rdb_filename);
- redis_check_rdb(server.rdb_filename);
+ if (!rdbCheckMode) {
+ serverLog(LL_WARNING, "Corrupt RDB detected at rdb.c:%d (%s). "
+ "Running 'redis-check-rdb %s'",
+ where, reason, server.rdb_filename);
+ char *argv[2] = {"",server.rdb_filename};
+ redis_check_rdb_main(2,argv);
+ } else {
+ rdbCheckError("Internal error in RDB reading function at rdb.c:%d (%s)",
+ where, reason);
+ }
exit(1);
}