summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2015-02-12 16:42:09 +0100
committerSalvatore Sanfilippo <antirez@gmail.com>2015-02-12 16:42:09 +0100
commit866b3fc0ec5c61fc3504df2b15445e79437a6b78 (patch)
tree532e4039973080003ed34079916d9083a55fead8
parent29b54db32091fb04a75a9dc196adc492e4933493 (diff)
parentba74711e0609b92721fc2d5a13c90aa88f623254 (diff)
downloadredis-866b3fc0ec5c61fc3504df2b15445e79437a6b78.tar.gz
Merge pull request #2357 from lamby/config-set-maxmemory-units
Support "1G" etc. units in CONFIG SET maxmemory
-rw-r--r--src/config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index 8255a56b7..927d7e245 100644
--- a/src/config.c
+++ b/src/config.c
@@ -643,8 +643,9 @@ 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")) {
- if (getLongLongFromObject(o,&ll) == REDIS_ERR ||
- ll < 0) goto badfmt;
+ int err;
+ ll = memtoll(o->ptr,&err);
+ if (err || ll < 0) goto badfmt;
server.maxmemory = ll;
if (server.maxmemory) {
if (server.maxmemory < zmalloc_used_memory()) {