From e4c51759f5d7dedd84a539e4cf5340e0043e11d2 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 9 Jan 2014 11:09:23 +0100 Subject: [PATCH] Fix RESTORE ttl handling in 32 bit archs. long was used instead of long long in order to handle a 64 bit resolution millisecond timestamp. This fixes issue #1483. --- src/migrate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/migrate.c b/src/migrate.c index 94aa1e40..3cc482fa 100644 --- a/src/migrate.c +++ b/src/migrate.c @@ -84,7 +84,7 @@ void dumpCommand(redisClient *c) { /* RESTORE key ttl serialized-value */ void restoreCommand(redisClient *c) { - long ttl; + long long ttl; rio payload; int type; robj *obj; @@ -96,7 +96,7 @@ void restoreCommand(redisClient *c) { } /* Check if the TTL value makes sense */ - if (getLongFromObjectOrReply(c,c->argv[2],&ttl,NULL) != REDIS_OK) { + if (getLongLongFromObjectOrReply(c,c->argv[2],&ttl,NULL) != REDIS_OK) { return; } else if (ttl < 0) { addReplyError(c,"Invalid TTL value, must be >= 0"); @@ -104,7 +104,8 @@ void restoreCommand(redisClient *c) { } /* Verify RDB version and data checksum. */ - if (verifyDumpPayload(c->argv[3]->ptr,sdslen(c->argv[3]->ptr)) == REDIS_ERR) { + if (verifyDumpPayload(c->argv[3]->ptr,sdslen(c->argv[3]->ptr)) == REDIS_ERR) + { addReplyError(c,"DUMP payload version or checksum are wrong"); return; }