Commit 0c1273c3 authored by Oran Agra's avatar Oran Agra Committed by antirez
Browse files

Fix client flags to be int64 in module.c

currently there's no bug since the flags these functions handle are
always lower than 32bit, but still better fix the type to prevent future
bugs.
parent 708a4e8a
...@@ -647,9 +647,9 @@ void RM_KeyAtPos(RedisModuleCtx *ctx, int pos) { ...@@ -647,9 +647,9 @@ void RM_KeyAtPos(RedisModuleCtx *ctx, int pos) {
* flags into the command flags used by the Redis core. * flags into the command flags used by the Redis core.
* *
* It returns the set of flags, or -1 if unknown flags are found. */ * It returns the set of flags, or -1 if unknown flags are found. */
int commandFlagsFromString(char *s) { int64_t commandFlagsFromString(char *s) {
int count, j; int count, j;
int flags = 0; int64_t flags = 0;
sds *tokens = sdssplitlen(s,strlen(s)," ",1,&count); sds *tokens = sdssplitlen(s,strlen(s)," ",1,&count);
for (j = 0; j < count; j++) { for (j = 0; j < count; j++) {
char *t = tokens[j]; char *t = tokens[j];
...@@ -727,7 +727,7 @@ int commandFlagsFromString(char *s) { ...@@ -727,7 +727,7 @@ int commandFlagsFromString(char *s) {
* other reason. * other reason.
*/ */
int RM_CreateCommand(RedisModuleCtx *ctx, const char *name, RedisModuleCmdFunc cmdfunc, const char *strflags, int firstkey, int lastkey, int keystep) { int RM_CreateCommand(RedisModuleCtx *ctx, const char *name, RedisModuleCmdFunc cmdfunc, const char *strflags, int firstkey, int lastkey, int keystep) {
int flags = strflags ? commandFlagsFromString((char*)strflags) : 0; int64_t flags = strflags ? commandFlagsFromString((char*)strflags) : 0;
if (flags == -1) return REDISMODULE_ERR; if (flags == -1) return REDISMODULE_ERR;
if ((flags & CMD_MODULE_NO_CLUSTER) && server.cluster_enabled) if ((flags & CMD_MODULE_NO_CLUSTER) && server.cluster_enabled)
return REDISMODULE_ERR; return REDISMODULE_ERR;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment