Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5daa50f

Browse files
committed
Revert "pg_resetwal: Improve error with wrong/missing data directory"
This reverts commit 1d863c2. This broke specifying the data directory as a relative path. Reported-by: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com> Discussion: https://www.postgresql.org/message-id/flat/TYAPR01MB58664AD301F511B1EA5B72B4F5C0A%40TYAPR01MB5866.jpnprd01.prod.outlook.com
1 parent d40d827 commit 5daa50f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/bin/pg_resetwal/pg_resetwal.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,17 @@ main(int argc, char *argv[])
345345

346346
get_restricted_token();
347347

348-
if (chdir(DataDir) < 0)
349-
pg_fatal("could not change directory to \"%s\": %m",
350-
DataDir);
351-
352348
/* Set mask based on PGDATA permissions */
353349
if (!GetDataDirectoryCreatePerm(DataDir))
354350
pg_fatal("could not read permissions of directory \"%s\": %m",
355351
DataDir);
356352

357353
umask(pg_mode_mask);
358354

355+
if (chdir(DataDir) < 0)
356+
pg_fatal("could not change directory to \"%s\": %m",
357+
DataDir);
358+
359359
/* Check that data directory matches our server version */
360360
CheckDataVersion();
361361

0 commit comments

Comments
 (0)