aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/initdb/initdb.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 3c35429045e..5217d9c7c3c 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -3650,10 +3650,19 @@ main(int argc, char *argv[])
exit(1);
}
- /* If we only need to fsync, just to it and exit */
+ /* If we only need to fsync, just do it and exit */
if (sync_only)
{
setup_pgdata();
+
+ /* must check that directory is readable */
+ if (pg_check_dir(pg_data) <= 0)
+ {
+ fprintf(stderr, _("%s: could not access directory \"%s\": %s\n"),
+ progname, pg_data, strerror(errno));
+ exit_nicely();
+ }
+
fsync_pgdata();
return 0;
}