From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Use plain mkdir() not pg_mkdir_p() to create subdirectories of P |
Date: | 2016-01-07 20:22:44 |
Message-ID: | E1aHH52-0001k7-MG@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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.
Branch
------
REL9_5_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/32e7e7fa77bab73c9df8ea4bdb1fd65793451ff6
Modified Files
--------------
src/bin/initdb/initdb.c | 49 +++++++++++++++++++++--------------------------
1 file changed, 22 insertions(+), 27 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2016-01-07 21:50:09 | Re: Re: [COMMITTERS] pgsql: Windows: Make pg_ctl reliably detect service status |
Previous Message | Alvaro Herrera | 2016-01-07 20:16:48 | Re: Re: [COMMITTERS] pgsql: Windows: Make pg_ctl reliably detect service status |