X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/58e34e6cb1499a00b9dfa51307e4188f8107fbe3..09f66a0be88b3dc846b763785dd258f72bf66d43:/src/rdb.c diff --git a/src/rdb.c b/src/rdb.c index 1e23fa70..6736d8fc 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -26,11 +26,6 @@ int rdbLoadType(rio *rdb) { return type; } -int rdbSaveTime(rio *rdb, time_t t) { - int32_t t32 = (int32_t) t; - return rdbWriteRaw(rdb,&t32,4); -} - time_t rdbLoadTime(rio *rdb) { int32_t t32; if (rioRead(rdb,&t32,4) == 0) return -1; @@ -602,6 +597,7 @@ int rdbSave(char *filename) { dictIterator *di = NULL; dictEntry *de; char tmpfile[256]; + char magic[10]; int j; long long now = mstime(); FILE *fp; @@ -616,7 +612,8 @@ int rdbSave(char *filename) { } rioInitWithFile(&rdb,fp); - if (rdbWriteRaw(&rdb,"REDIS0004",9) == -1) goto werr; + snprintf(magic,sizeof(magic),"REDIS%04d",REDIS_RDB_VERSION); + if (rdbWriteRaw(&rdb,magic,9) == -1) goto werr; for (j = 0; j < server.dbnum; j++) { redisDb *db = server.db+j;