From 7991cfe22b54b5b9f2bf392b52b9a67809524309 Mon Sep 17 00:00:00 2001 From: cchen676 Date: Mon, 27 Sep 2021 20:34:15 +0800 Subject: [PATCH] =?UTF-8?q?fix=20gs=5Fguc=E9=85=8D=E7=BD=AEsynchrounous=5F?= =?UTF-8?q?name=E5=8F=82=E6=95=B0=E5=A4=B1=E8=B4=A5=20=E7=A4=BE=E5=8C=BA?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=9B=9E=E5=90=88=E6=97=B6=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=AF=BC=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin/gs_guc/cluster_guc.cpp | 8 ++------ src/bin/pg_ctl/pg_ctl.cpp | 13 +++++++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/bin/gs_guc/cluster_guc.cpp b/src/bin/gs_guc/cluster_guc.cpp index 90da1752d..69ba04947 100644 --- a/src/bin/gs_guc/cluster_guc.cpp +++ b/src/bin/gs_guc/cluster_guc.cpp @@ -1877,18 +1877,14 @@ char* get_AZ_value(const char* value, const char* data_dir) if (NULL == nodenameList) { // try dn - len = strlen(q); + len = strlen(q) + 1; s = (char *)pg_malloc_zero(len * sizeof(char)); - nRet = snprintf_s(s, len + 1, len, "%s", q); + nRet = snprintf_s(s, len, len - 1, "%s", q); securec_check_ss_c(nRet, s, "\0"); vptr = strtok_r(s, delims, &vouter_ptr); while (vptr != NULL) { p = vptr; - int len_p = strlen(p) + 1; - char *temp = (char *)pg_malloc_zero(len_p * sizeof(char)); - nRet = snprintf_s(temp, len_p + 1, len_p, "%s,", p); - securec_check_ss_c(nRet, temp, "\0"); if (CheckDataNameValue(p, data_dir) == false) { goto failed; diff --git a/src/bin/pg_ctl/pg_ctl.cpp b/src/bin/pg_ctl/pg_ctl.cpp index 07d27c1c8..52a07cd91 100755 --- a/src/bin/pg_ctl/pg_ctl.cpp +++ b/src/bin/pg_ctl/pg_ctl.cpp @@ -4070,11 +4070,11 @@ static void find_nested_pgconf(const char** optlines, char* opt_name) while (isspace((unsigned char)*p)) { p++; } - pg_fatal( - _("There is nested config file in postgresql.conf: %sWhich is not supported by full build. " + pg_log(PG_WARNING, + _("There is nested config file in postgresql.conf: %sWhich is not supported by build. " "Please move out the nested config files from %s and comment the 'include' config in postgresql.conf.\n" - "You can add option '-q' to disable autostart during full build and restore the change manually " - "before starting gaussdb."), + "You can add option '-q' to disable autostart during build and restore the change manually " + "before starting gaussdb.\n"), p, pg_data); exit(1); @@ -4093,6 +4093,11 @@ static void check_nested_pgconf(void) config_file[MAXPGPATH - 1] = '\0'; optlines = readfile(config_file); + if (optlines == NULL) { + pg_log(PG_WARNING, _("%s cannot be opened.\n"), config_file); + exit(1); + } + for (int i = 0; i < (int)lengthof(optname); i++) { find_nested_pgconf((const char**)optlines, optname[i]); }