mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 00:52:38 +00:00
AOF & RDB: be compatible with rdbchecksum no
This commit is contained in:
parent
4630da375c
commit
eafaf17269
16
src/rdb.c
16
src/rdb.c
@ -1649,16 +1649,18 @@ int rdbLoadRio(rio *rdb, rdbSaveInfo *rsi) {
|
||||
decrRefCount(key);
|
||||
}
|
||||
/* Verify the checksum if RDB version is >= 5 */
|
||||
if (rdbver >= 5 && server.rdb_checksum) {
|
||||
if (rdbver >= 5) {
|
||||
uint64_t cksum, expected = rdb->cksum;
|
||||
|
||||
if (rioRead(rdb,&cksum,8) == 0) goto eoferr;
|
||||
memrev64ifbe(&cksum);
|
||||
if (cksum == 0) {
|
||||
serverLog(LL_WARNING,"RDB file was saved with checksum disabled: no check performed.");
|
||||
} else if (cksum != expected) {
|
||||
serverLog(LL_WARNING,"Wrong RDB checksum. Aborting now.");
|
||||
rdbExitReportCorruptRDB("RDB CRC error");
|
||||
if (server.rdb_checksum) {
|
||||
memrev64ifbe(&cksum);
|
||||
if (cksum == 0) {
|
||||
serverLog(LL_WARNING,"RDB file was saved with checksum disabled: no check performed.");
|
||||
} else if (cksum != expected) {
|
||||
serverLog(LL_WARNING,"Wrong RDB checksum. Aborting now.");
|
||||
rdbExitReportCorruptRDB("RDB CRC error");
|
||||
}
|
||||
}
|
||||
}
|
||||
return C_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user