From 1d96c1b91a4b7da6288ee63671a234b557ff5ccf Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 23 May 2018 10:59:55 -0400 Subject: Fix incorrect ordering of operations in pg_resetwal and pg_rewind. Commit c37b3d08c dropped its added GetDataDirectoryCreatePerm call into the wrong place in pg_resetwal.c, namely after the chdir to DataDir. That broke invocations using a relative path, as reported by Tushar Ahuja. We could have left it where it was and changed the argument to be ".", but that'd result in a rather confusing error message in event of a failure, so re-ordering seems like a better solution. Similarly reorder operations in pg_rewind.c. The issue there is that it doesn't seem like a good idea to do any actual operations before the not-root check (on Unix) or the restricted token acquisition (on Windows). I don't know that this is an actual bug, but I'm definitely not convinced that it isn't, either. Assorted other code review for c37b3d08c and da9b580d8: fix some misspelled or otherwise badly worded comments, put the #include for where it actually belongs, etc. Discussion: https://postgr.es/m/aeb9c3a7-3c3f-a57f-1a18-c8d4fcdc2a1f@enterprisedb.com --- src/backend/utils/init/globals.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/backend/utils') diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c index 36ffd874a40..f7d6617a138 100644 --- a/src/backend/utils/init/globals.c +++ b/src/backend/utils/init/globals.c @@ -18,8 +18,6 @@ */ #include "postgres.h" -#include - #include "common/file_perm.h" #include "libpq/libpq-be.h" #include "libpq/pqcomm.h" @@ -63,7 +61,7 @@ struct Latch *MyLatch; char *DataDir = NULL; /* - * Mode of the data directory. The default is 0700 but may it be changed in + * Mode of the data directory. The default is 0700 but it may be changed in * checkDataDir() to 0750 if the data directory actually has that mode. */ int data_directory_mode = PG_DIR_MODE_OWNER; -- cgit v1.2.3