From 52c85928d221beada77fa8ca79913c1569782e97 Mon Sep 17 00:00:00 2001 From: yupeng Date: Mon, 31 Aug 2020 18:52:35 +0800 Subject: [PATCH] fix pghost bug --- src/common/backend/utils/init/miscinit.cpp | 11 +---------- src/include/libpq/pqcomm.h | 10 +--------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/common/backend/utils/init/miscinit.cpp b/src/common/backend/utils/init/miscinit.cpp index 1aab5afed..44396ce68 100755 --- a/src/common/backend/utils/init/miscinit.cpp +++ b/src/common/backend/utils/init/miscinit.cpp @@ -1208,19 +1208,10 @@ static void CreateLockFile(const char* file_name, bool am_post_master, bool is_d * the datadir lockfile later. */ char* unix_socket_dir = NULL; - char* pg_host = gs_getenv_r("PGHOST"); - if (pg_host != NULL) { - check_backend_env(pg_host); - } - if (*g_instance.attr.attr_network.UnixSocketDir != '\0') { unix_socket_dir = g_instance.attr.attr_network.UnixSocketDir; } else { - if (pg_host != NULL && *(pg_host) != '\0') { - unix_socket_dir = pg_host; - } else { - unix_socket_dir = DEFAULT_PGSOCKET_DIR; - } + unix_socket_dir = DEFAULT_PGSOCKET_DIR; } int rc = snprintf_s(buffer, diff --git a/src/include/libpq/pqcomm.h b/src/include/libpq/pqcomm.h index b6e0ec9cb..00a9bbe8e 100755 --- a/src/include/libpq/pqcomm.h +++ b/src/include/libpq/pqcomm.h @@ -67,18 +67,10 @@ extern const char* check_client_env(const char* input_env_value); do { \ int rc = 0; \ const char* unixSocketDir = NULL; \ - const char* pghost = gs_getenv_r("PGHOST"); \ - if (check_client_env(pghost) == NULL) { \ - pghost = NULL; \ - } \ if (sockdir != NULL && (*sockdir) != '\0') { \ unixSocketDir = sockdir; \ } else { \ - if (pghost != NULL && (*pghost) != '\0') { \ - unixSocketDir = pghost; \ - } else { \ - unixSocketDir = DEFAULT_PGSOCKET_DIR; \ - } \ + unixSocketDir = DEFAULT_PGSOCKET_DIR; \ } \ rc = snprintf_s(path, sizeof(path), sizeof(path) - 1, "%s/.s.PGSQL.%d", unixSocketDir, (port)); \ securec_check_ss_c(rc, "\0", "\0"); \