redis: Fix the bug which parsing arg ERRO.

For using the redis, we should allow users to configure
theirs configure file. Now fstack uses the options as below:
—-conf config.ini --proc-type= --proc-id=

And we should skip 4 args(including program name arg), not 3.

Use the redis-config-file:
bin/redis-server --conf config.ini \
	--proc-type=primary --proc-id=0 redis-3.2.8/redis.conf

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
This commit is contained in:
Tonghao Zhang 2017-08-25 00:05:09 -07:00
parent 830124b89c
commit f7ca998abb
1 changed files with 7 additions and 7 deletions

View File

@ -3957,17 +3957,17 @@ int main(int argc, char **argv) {
int rc = ff_init(argc, argv);
assert(0 == rc);
ff_mod_init();
//split fstack arguments.
int new_argc = argc - 3;
int new_argc = argc - 4;
if (new_argc <= 0) {
new_argc = 1;
}
char **new_argv = zmalloc(sizeof(char *) * new_argc);
char **new_argv = zmalloc(sizeof(char *) * new_argc);
new_argv[0] = argv[0];
int i;
for (i = 1; i < new_argc; i++) {
new_argv[i] = argv[i + 3];
}
int i;
for (i = 1; i < new_argc; i++) {
new_argv[i] = argv[i + 4];
}
argv = new_argv;
argc = new_argc;
#endif