mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Merge pull request #4908 from soloestoy/aof-rdb-preamble-compatible-checksum-no
AOF & RDB: be compatible with rdbchecksum no
This commit is contained in:
commit
1ab3c82375
16
src/rdb.c
16
src/rdb.c
@ -2027,16 +2027,18 @@ int rdbLoadRio(rio *rdb, rdbSaveInfo *rsi) {
|
|||||||
lru_idle = -1;
|
lru_idle = -1;
|
||||||
}
|
}
|
||||||
/* Verify the checksum if RDB version is >= 5 */
|
/* Verify the checksum if RDB version is >= 5 */
|
||||||
if (rdbver >= 5 && server.rdb_checksum) {
|
if (rdbver >= 5) {
|
||||||
uint64_t cksum, expected = rdb->cksum;
|
uint64_t cksum, expected = rdb->cksum;
|
||||||
|
|
||||||
if (rioRead(rdb,&cksum,8) == 0) goto eoferr;
|
if (rioRead(rdb,&cksum,8) == 0) goto eoferr;
|
||||||
memrev64ifbe(&cksum);
|
if (server.rdb_checksum) {
|
||||||
if (cksum == 0) {
|
memrev64ifbe(&cksum);
|
||||||
serverLog(LL_WARNING,"RDB file was saved with checksum disabled: no check performed.");
|
if (cksum == 0) {
|
||||||
} else if (cksum != expected) {
|
serverLog(LL_WARNING,"RDB file was saved with checksum disabled: no check performed.");
|
||||||
serverLog(LL_WARNING,"Wrong RDB checksum. Aborting now.");
|
} else if (cksum != expected) {
|
||||||
rdbExitReportCorruptRDB("RDB CRC error");
|
serverLog(LL_WARNING,"Wrong RDB checksum. Aborting now.");
|
||||||
|
rdbExitReportCorruptRDB("RDB CRC error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return C_OK;
|
return C_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user