summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lamb <chris@chris-lamb.co.uk>2015-02-04 18:36:38 +0000
committerantirez <antirez@gmail.com>2015-02-12 16:54:30 +0100
commit260cfcf7bd3ea81ee7811eac44c01386e8e6e87a (patch)
tree84bbfde4ff72c8163db3e5ab782053e9a87d9465
parent967590de6efcbced49825d99fba984255993d403 (diff)
downloadredis-260cfcf7bd3ea81ee7811eac44c01386e8e6e87a.tar.gz
Support "1G" etc. units in CONFIG SET maxmemory
Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
-rw-r--r--src/config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index 05cb7c9fe..af5c855c7 100644
--- a/src/config.c
+++ b/src/config.c
@@ -628,8 +628,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()) {