X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/9791f0f8ceb18e2e3c297a8c479307b7af0f9830..f797c7dc176c833e6aa412c557d7fedd59dc1124:/src/db.c diff --git a/src/db.c b/src/db.c index 9bc299ca..85a22062 100644 --- a/src/db.c +++ b/src/db.c @@ -307,6 +307,10 @@ void existsCommand(redisClient *c) { void selectCommand(redisClient *c) { int id = atoi(c->argv[1]->ptr); + if (server.cluster_enabled) { + addReplyError(c,"SELECT is not allowed in cluster mode"); + return; + } if (selectDb(c,id) == REDIS_ERR) { addReplyError(c,"invalid DB index"); } else { @@ -428,6 +432,11 @@ void moveCommand(redisClient *c) { redisDb *src, *dst; int srcid; + if (server.cluster_enabled) { + addReplyError(c,"MOVE is not allowed in cluster mode"); + return; + } + /* Obtain source and target DB pointers */ src = c->db; srcid = c->db->id; @@ -634,8 +643,9 @@ int *getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, in keys = zmalloc(sizeof(int)*((last - cmd->firstkey)+1)); for (j = cmd->firstkey; j <= last; j += cmd->keystep) { redisAssert(j < argc); - keys[i] = j; + keys[i++] = j; } + *numkeys = i; return keys; } @@ -665,7 +675,7 @@ int *renameGetKeys(struct redisCommand *cmd,robj **argv, int argc, int *numkeys, int *keys = zmalloc(sizeof(int)); *numkeys = 1; keys[0] = 1; - return NULL; + return keys; } else { return getKeysUsingCommandTable(cmd,argv,argc,numkeys); } @@ -683,7 +693,7 @@ int *zunionInterGetKeys(struct redisCommand *cmd,robj **argv, int argc, int *num *numkeys = 0; return NULL; } - keys = zmalloc(num); + keys = zmalloc(sizeof(int)*num); for (i = 0; i < num; i++) keys[i] = 3+i; *numkeys = num; return keys;