fix.patch

application/octet-stream

Filename: fix.patch
Type: application/octet-stream
Part: 3
Message: pg_resetwal regression: could not upgrade after 1d863c2504

Patch

Format: unified
File+
src/bin/pg_resetwal/pg_resetwal.c 4 0
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
index e344c9284d..8ba3993dd4 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -349,6 +349,8 @@ main(int argc, char *argv[])
 		pg_fatal("could not change directory to \"%s\": %m",
 				 DataDir);
 
+	(void) chdir("../");
+
 	/* Set mask based on PGDATA permissions */
 	if (!GetDataDirectoryCreatePerm(DataDir))
 		pg_fatal("could not read permissions of directory \"%s\": %m",
@@ -356,6 +358,8 @@ main(int argc, char *argv[])
 
 	umask(pg_mode_mask);
 
+	(void) chdir(DataDir);
+
 	/* Check that data directory matches our server version */
 	CheckDataVersion();