Skip to content

Commit 2712ca7

Browse files
committed
Fix initdb use of mkdir_p().
Andrew Dunstan
1 parent 15b5d6c commit 2712ca7

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/bin/initdb/initdb.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* Portions Copyright (c) 1994, Regents of the University of California
4444
* Portions taken from FreeBSD.
4545
*
46-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.15 2003/11/29 19:52:04 pgsql Exp $
46+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.16 2003/12/01 23:15:47 momjian Exp $
4747
*
4848
*-------------------------------------------------------------------------
4949
*/
@@ -801,7 +801,6 @@ static bool
801801
mkdatadir(char *subdir)
802802
{
803803
char *path;
804-
int res;
805804

806805
path = xmalloc(strlen(pg_data) + 2 +
807806
(subdir == NULL ? 0 : strlen(subdir)));
@@ -811,13 +810,7 @@ mkdatadir(char *subdir)
811810
else
812811
strcpy(path, pg_data);
813812

814-
res = mkdir(path, 0700);
815-
if (res == 0)
816-
return true;
817-
else if (subdir == NULL || errno != ENOENT)
818-
return false;
819-
else
820-
return !mkdir_p(path, 0700);
813+
return (mkdir_p(path, 0700) == 0);
821814
}
822815

823816

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy