initdb -S should now have an explicit check that $PGDATA is valid.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 1943c000b7a22d3ca334196cfe3f7b8159b210c2
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2015-05-29T21:02:58Z
Releases: 9.5.0
initdb -S should now have an explicit check that $PGDATA is valid.

The fsync code from the backend essentially assumes that somebody's already
validated PGDATA, at least to the extent of it being a readable directory.
That's safe enough for initdb's normal code path too, but "initdb -S"
doesn't have any other processing at all that touches the target directory.
To have reasonable error-case behavior, add a pg_check_dir call.
Per gripe from Peter E.

Files

PathChange+/−
src/bin/initdb/initdb.c modified +10 −1