mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
parent
866b3fc0ec
commit
cd4e0f43df
10
src/config.c
10
src/config.c
@ -624,6 +624,7 @@ void loadServerConfig(char *filename, char *options) {
|
|||||||
void configSetCommand(redisClient *c) {
|
void configSetCommand(redisClient *c) {
|
||||||
robj *o;
|
robj *o;
|
||||||
long long ll;
|
long long ll;
|
||||||
|
int err;
|
||||||
redisAssertWithInfo(c,c->argv[2],sdsEncodedObject(c->argv[2]));
|
redisAssertWithInfo(c,c->argv[2],sdsEncodedObject(c->argv[2]));
|
||||||
redisAssertWithInfo(c,c->argv[3],sdsEncodedObject(c->argv[3]));
|
redisAssertWithInfo(c,c->argv[3],sdsEncodedObject(c->argv[3]));
|
||||||
o = c->argv[3];
|
o = c->argv[3];
|
||||||
@ -643,7 +644,6 @@ void configSetCommand(redisClient *c) {
|
|||||||
zfree(server.masterauth);
|
zfree(server.masterauth);
|
||||||
server.masterauth = ((char*)o->ptr)[0] ? zstrdup(o->ptr) : NULL;
|
server.masterauth = ((char*)o->ptr)[0] ? zstrdup(o->ptr) : NULL;
|
||||||
} else if (!strcasecmp(c->argv[2]->ptr,"maxmemory")) {
|
} else if (!strcasecmp(c->argv[2]->ptr,"maxmemory")) {
|
||||||
int err;
|
|
||||||
ll = memtoll(o->ptr,&err);
|
ll = memtoll(o->ptr,&err);
|
||||||
if (err || ll < 0) goto badfmt;
|
if (err || ll < 0) goto badfmt;
|
||||||
server.maxmemory = ll;
|
server.maxmemory = ll;
|
||||||
@ -867,7 +867,6 @@ void configSetCommand(redisClient *c) {
|
|||||||
* whole configuration string or accept it all, even if a single
|
* whole configuration string or accept it all, even if a single
|
||||||
* error in a single client class is present. */
|
* error in a single client class is present. */
|
||||||
for (j = 0; j < vlen; j++) {
|
for (j = 0; j < vlen; j++) {
|
||||||
char *eptr;
|
|
||||||
long val;
|
long val;
|
||||||
|
|
||||||
if ((j % 4) == 0) {
|
if ((j % 4) == 0) {
|
||||||
@ -876,8 +875,8 @@ void configSetCommand(redisClient *c) {
|
|||||||
goto badfmt;
|
goto badfmt;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val = strtoll(v[j], &eptr, 10);
|
val = memtoll(v[j], &err);
|
||||||
if (eptr[0] != '\0' || val < 0) {
|
if (err || val < 0) {
|
||||||
sdsfreesplitres(v,vlen);
|
sdsfreesplitres(v,vlen);
|
||||||
goto badfmt;
|
goto badfmt;
|
||||||
}
|
}
|
||||||
@ -911,7 +910,8 @@ void configSetCommand(redisClient *c) {
|
|||||||
if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll <= 0) goto badfmt;
|
if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll <= 0) goto badfmt;
|
||||||
server.repl_timeout = ll;
|
server.repl_timeout = ll;
|
||||||
} else if (!strcasecmp(c->argv[2]->ptr,"repl-backlog-size")) {
|
} 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);
|
resizeReplicationBacklog(ll);
|
||||||
} else if (!strcasecmp(c->argv[2]->ptr,"repl-backlog-ttl")) {
|
} else if (!strcasecmp(c->argv[2]->ptr,"repl-backlog-ttl")) {
|
||||||
if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll < 0) goto badfmt;
|
if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll < 0) goto badfmt;
|
||||||
|
Loading…
Reference in New Issue
Block a user