Unable to establish connection when IP address is NULL

This commit is contained in:
root 2019-11-09 13:39:30 +08:00
parent 1c3fcabe04
commit 3c3edeb241
1 changed files with 1 additions and 1 deletions

View File

@ -157,7 +157,7 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const
}
TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, int port) {
if (ip != NULL && (strcmp("127.0.0.1", ip) == 0 || strcasecmp("localhost", ip) == 0)) {
if (ip == NULL || (ip != NULL && (strcmp("127.0.0.1", ip) == 0 || strcasecmp("localhost", ip) == 0))) {
#ifdef CLUSTER
ip = tsPrivateIp;
#else