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) {