aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_resetwal/pg_resetwal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_resetwal/pg_resetwal.c')
-rw-r--r--src/bin/pg_resetwal/pg_resetwal.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
index 74063ebf2f9..159a30b520a 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -54,6 +54,7 @@
#include "common/file_perm.h"
#include "common/logging.h"
#include "common/restricted_token.h"
+#include "common/string.h"
#include "storage/large_object.h"
#include "pg_getopt.h"
#include "getopt_long.h"
@@ -538,7 +539,6 @@ CheckDataVersion(void)
const char *ver_file = "PG_VERSION";
FILE *ver_fd;
char rawline[64];
- int len;
if ((ver_fd = fopen(ver_file, "r")) == NULL)
{
@@ -557,12 +557,8 @@ CheckDataVersion(void)
exit(1);
}
- /* remove trailing newline, handling Windows newlines as well */
- len = strlen(rawline);
- while (len > 0 &&
- (rawline[len - 1] == '\n' ||
- rawline[len - 1] == '\r'))
- rawline[--len] = '\0';
+ /* strip trailing newline and carriage return */
+ (void) pg_strip_crlf(rawline);
if (strcmp(rawline, PG_MAJORVERSION) != 0)
{