diff options
Diffstat (limited to 'src/backend/libpq/be-secure-common.c')
-rw-r--r-- | src/backend/libpq/be-secure-common.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/backend/libpq/be-secure-common.c b/src/backend/libpq/be-secure-common.c index 4abbef5bf19..e8f27bc7825 100644 --- a/src/backend/libpq/be-secure-common.c +++ b/src/backend/libpq/be-secure-common.c @@ -22,6 +22,7 @@ #include <sys/stat.h> #include <unistd.h> +#include "common/string.h" #include "libpq/libpq.h" #include "storage/fd.h" @@ -112,11 +113,8 @@ run_ssl_passphrase_command(const char *prompt, bool is_server_start, char *buf, goto error; } - /* strip trailing newline, including \r in case we're on Windows */ - len = strlen(buf); - while (len > 0 && (buf[len - 1] == '\n' || - buf[len - 1] == '\r')) - buf[--len] = '\0'; + /* strip trailing newline and carriage return */ + len = pg_strip_crlf(buf); error: pfree(command.data); |