diff --git a/src/benchJsonOpt.c b/src/benchJsonOpt.c index 45f10b83..f458b663 100644 --- a/src/benchJsonOpt.c +++ b/src/benchJsonOpt.c @@ -1390,12 +1390,20 @@ static int getMetaFromCommonJsonFile(tools_cJSON *json) { tools_cJSON *host = tools_cJSON_GetObjectItem(json, "host"); if (host && host->type == tools_cJSON_String && host->valuestring != NULL) { - g_arguments->host = host->valuestring; + if(g_arguments->host && strlen(g_arguments->host) > 0) { + warnPrint("command line already pass host is %s, json config host(%s) had been ignored.\n", g_arguments->host, host->valuestring); + } else { + g_arguments->host = host->valuestring; + } } tools_cJSON *port = tools_cJSON_GetObjectItem(json, "port"); if (port && port->type == tools_cJSON_Number) { - g_arguments->port = (uint16_t)port->valueint; + if(g_arguments->port != DEFAULT_PORT) { + warnPrint("command line already pass port is %d, json config port(%d) had been ignored.\n", g_arguments->port, (uint16_t)port->valueint); + } else { + g_arguments->port = (uint16_t)port->valueint; + } } tools_cJSON *user = tools_cJSON_GetObjectItem(json, "user");