]> granicus.if.org Git - postgresql/commit
Use plain mkdir() not pg_mkdir_p() to create subdirectories of PGDATA.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Jan 2016 20:22:01 +0000 (15:22 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Jan 2016 20:22:01 +0000 (15:22 -0500)
commit882c592d0c0cfc29a8265f382316c58cb8b81c66
tree0b65b697c4a4ddbf4afe242bb9840d06545cc30c
parentc7aca3d45b3dc97461be94c836a7deeeca4111b2
Use plain mkdir() not pg_mkdir_p() to create subdirectories of PGDATA.

When we're creating subdirectories of PGDATA during initdb, we know darn
well that the parent directory exists (or should exist) and that the new
subdirectory doesn't (or shouldn't).  There is therefore no need to use
anything more complicated than mkdir().  Using pg_mkdir_p() just opens us
up to unexpected failure modes, such as the one exhibited in bug #13853
from Nuri Boardman.  It's not very clear why pg_mkdir_p() went wrong there,
but it is clear that we didn't need to be trying to create parent
directories in the first place.  We're not even saving any code, as proven
by the fact that this patch nets out at minus five lines.

Since this is a response to a field bug report, back-patch to all branches.
src/bin/initdb/initdb.c