From 618c5d1ac2fa78c79db07a4ccea406564ed68146 Mon Sep 17 00:00:00 2001 From: chendong76 <1209756284@qq.com> Date: Tue, 23 May 2023 14:46:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B5=84=E6=BA=90=E6=B1=A0?= =?UTF-8?q?=E5=8C=96=E5=B7=A5=E5=85=B7pagehack,pg=5Fxlogdump,pg=5Fcontrold?= =?UTF-8?q?ata,pg=5Fresetxlog=E9=92=88=E5=AF=B9socketpath=E5=90=88?= =?UTF-8?q?=E6=B3=95=E5=80=BC=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/pagehack/pagehack.cpp | 5 +++-- contrib/pg_xlogdump/pg_xlogdump.cpp | 6 ++++-- src/bin/pg_controldata/pg_controldata.cpp | 5 +++-- src/bin/pg_resetxlog/pg_resetxlog.cpp | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/contrib/pagehack/pagehack.cpp b/contrib/pagehack/pagehack.cpp index 08b10845e..1598c2d18 100644 --- a/contrib/pagehack/pagehack.cpp +++ b/contrib/pagehack/pagehack.cpp @@ -5754,8 +5754,9 @@ int main(int argc, char** argv) exit(1); } - if (enable_dss && socketpath == NULL) { - fprintf(stderr, "Socketpath cannot be NULL when enable dss.\n"); + if (enable_dss && (socketpath == NULL || strlen(socketpath) == 0 || strncmp("UDS:", socketpath, 4) != 0)) { + fprintf(stderr, "Socketpath must be specific correctly when enable dss, " + "format is: '-c UDS:xxx'.\n"); exit(1); } diff --git a/contrib/pg_xlogdump/pg_xlogdump.cpp b/contrib/pg_xlogdump/pg_xlogdump.cpp index 4885fff5c..723db46a1 100644 --- a/contrib/pg_xlogdump/pg_xlogdump.cpp +++ b/contrib/pg_xlogdump/pg_xlogdump.cpp @@ -1012,8 +1012,10 @@ int main(int argc, char** argv) } if (dumpprivate.enable_dss) { - if (dumpprivate.socketpath == NULL) { - fprintf(stderr, "%s: socketpath cannot be NULL when enable dss\n", progname); + if (dumpprivate.socketpath == NULL || strlen(dumpprivate.socketpath) == 0 || + strncmp("UDS:", dumpprivate.socketpath, 4) != 0) { + fprintf(stderr, "%s: socketpath must be specific correctly when enable dss, " + "format is: '--socketpath=\"UDS:xxx\"'.\n", progname); goto bad_argument; } diff --git a/src/bin/pg_controldata/pg_controldata.cpp b/src/bin/pg_controldata/pg_controldata.cpp index 328d76f7c..845d552c7 100644 --- a/src/bin/pg_controldata/pg_controldata.cpp +++ b/src/bin/pg_controldata/pg_controldata.cpp @@ -327,8 +327,9 @@ int main(int argc, char* argv[]) check_env_value_c(DataDir); if (enable_dss) { - if (socketpath == NULL) { - fprintf(stderr, _("%s: socketpath cannot be NULL when enable dss\n"), progname); + if (socketpath == NULL || strlen(socketpath) == 0 || strncmp("UDS:", socketpath, 4) != 0) { + fprintf(stderr, _("%s: socketpath must be specific correctly when enable dss, " + "format is: '--socketpath=\"UDS:xxx\"'.\n"), progname); exit_safely(1); } diff --git a/src/bin/pg_resetxlog/pg_resetxlog.cpp b/src/bin/pg_resetxlog/pg_resetxlog.cpp index 1038c7010..b3040e936 100644 --- a/src/bin/pg_resetxlog/pg_resetxlog.cpp +++ b/src/bin/pg_resetxlog/pg_resetxlog.cpp @@ -284,8 +284,9 @@ int main(int argc, char* argv[]) } if (dss.enable_dss) { - if (dss.socketpath == NULL) { - fprintf(stderr, _("%s: socketpath cannot be NULL when enable dss\n"), progname); + if (dss.socketpath == NULL || strlen(dss.socketpath) == 0 || strncmp("UDS:", dss.socketpath, 4) != 0) { + fprintf(stderr, _("%s: socketpath must be specific correctly when enable dss, " + "format is: '--socketpath=\"UDS:xxx\"'.\n"), progname); exit(1); } if (dss.vgname == NULL) {