summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/config.c b/src/config.c
index 927d7e245..3963a1218 100644
--- a/src/config.c
+++ b/src/config.c
@@ -624,6 +624,7 @@ void loadServerConfig(char *filename, char *options) {
void configSetCommand(redisClient *c) {
robj *o;
long long ll;
+ int err;
redisAssertWithInfo(c,c->argv[2],sdsEncodedObject(c->argv[2]));
redisAssertWithInfo(c,c->argv[3],sdsEncodedObject(c->argv[3]));
o = c->argv[3];
@@ -643,7 +644,6 @@ void configSetCommand(redisClient *c) {
zfree(server.masterauth);
server.masterauth = ((char*)o->ptr)[0] ? zstrdup(o->ptr) : NULL;
} else if (!strcasecmp(c->argv[2]->ptr,"maxmemory")) {
- int err;
ll = memtoll(o->ptr,&err);
if (err || ll < 0) goto badfmt;
server.maxmemory = ll;
@@ -867,7 +867,6 @@ void configSetCommand(redisClient *c) {
* whole configuration string or accept it all, even if a single
* error in a single client class is present. */
for (j = 0; j < vlen; j++) {
- char *eptr;
long val;
if ((j % 4) == 0) {
@@ -876,8 +875,8 @@ void configSetCommand(redisClient *c) {
goto badfmt;
}
} else {
- val = strtoll(v[j], &eptr, 10);
- if (eptr[0] != '\0' || val < 0) {
+ val = memtoll(v[j], &err);
+ if (err || val < 0) {
sdsfreesplitres(v,vlen);
goto badfmt;
}
@@ -911,7 +910,8 @@ void configSetCommand(redisClient *c) {
if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll <= 0) goto badfmt;
server.repl_timeout = ll;
} else if (!strcasecmp(c->argv[2]->ptr,"repl-backlog-size")) {
- if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll <= 0) goto badfmt;
+ ll = memtoll(o->ptr,&err);
+ if (err || ll < 0) goto badfmt;
resizeReplicationBacklog(ll);
} else if (!strcasecmp(c->argv[2]->ptr,"repl-backlog-ttl")) {
if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll < 0) goto badfmt;