From: antirez Date: Mon, 2 Apr 2012 08:46:24 +0000 (+0200) Subject: DUMP / RESTORE: store RDB version in little endian. X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/bd0446593108865895474edd403783ec9eaf5a34 DUMP / RESTORE: store RDB version in little endian. --- diff --git a/src/cluster.c b/src/cluster.c index 7be39ebc..d0de9596 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1479,8 +1479,8 @@ void createDumpPayload(rio *payload, robj *o) { * ----------------+---------------------+--------------+ * The SHA1 is just 8 bytes of truncated SHA1 of everything excluding itself. * The 2 bytes RDB version is a little endian unsigned integer. */ - buf[0] = (REDIS_RDB_VERSION >> 8) & 0xff; - buf[1] = REDIS_RDB_VERSION & 0xff; + buf[0] = REDIS_RDB_VERSION & 0xff; + buf[1] = (REDIS_RDB_VERSION >> 8) & 0xff; payload->io.buffer.ptr = sdscatlen(payload->io.buffer.ptr,buf,2); SHA1Init(&ctx); @@ -1501,7 +1501,7 @@ int verifyDumpPayload(unsigned char *p, size_t len) { if (len < 10) return REDIS_ERR; footer = p+(len-10); - rdbver = (footer[0] << 8) | footer[1]; + rdbver = (footer[1] << 8) | footer[0]; if (rdbver != REDIS_RDB_VERSION) return REDIS_ERR; SHA1Init(&ctx); SHA1Update(&ctx,p,len-8);