Commit 2712ca77 authored by Bruce Momjian's avatar Bruce Momjian

Fix initdb use of mkdir_p().

Andrew Dunstan
parent 15b5d6cf
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD. * Portions taken from FreeBSD.
* *
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.15 2003/11/29 19:52:04 pgsql Exp $ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.16 2003/12/01 23:15:47 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -801,7 +801,6 @@ static bool ...@@ -801,7 +801,6 @@ static bool
mkdatadir(char *subdir) mkdatadir(char *subdir)
{ {
char *path; char *path;
int res;
path = xmalloc(strlen(pg_data) + 2 + path = xmalloc(strlen(pg_data) + 2 +
(subdir == NULL ? 0 : strlen(subdir))); (subdir == NULL ? 0 : strlen(subdir)));
...@@ -811,13 +810,7 @@ mkdatadir(char *subdir) ...@@ -811,13 +810,7 @@ mkdatadir(char *subdir)
else else
strcpy(path, pg_data); strcpy(path, pg_data);
res = mkdir(path, 0700); return (mkdir_p(path, 0700) == 0);
if (res == 0)
return true;
else if (subdir == NULL || errno != ENOENT)
return false;
else
return !mkdir_p(path, 0700);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment