]> git.saurik.com Git - redis.git/commitdiff
Fixed issue 72 (SLAVEOF shutdowns redis-server on malformed reply)
authorantirez <antirez@gmail.com>
Thu, 29 Oct 2009 10:38:32 +0000 (11:38 +0100)
committerantirez <antirez@gmail.com>
Thu, 29 Oct 2009 10:38:32 +0000 (11:38 +0100)
redis.c

diff --git a/redis.c b/redis.c
index e4f1a76332d02f719bcaf2907e46b67df3f1a4e2..c730c04cdb108b48a15b223deff0195505fd726a 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -5071,6 +5071,11 @@ static int syncWithMaster(void) {
             strerror(errno));
         return REDIS_ERR;
     }
+    if (buf[0] != '$') {
+        close(fd);
+        redisLog(REDIS_WARNING,"Bad protocol from MASTER, the first byte is not '$', are you sure the host and port are right?");
+        return REDIS_ERR;
+    }
     dumpsize = atoi(buf+1);
     redisLog(REDIS_NOTICE,"Receiving %d bytes data dump from MASTER",dumpsize);
     /* Read the bulk write data on a temp file */