1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-23 11:45:36 +02:00

Fix work under BSD.

This commit is contained in:
stalkerg 2016-03-24 18:30:25 +03:00
parent 30845bf4a6
commit fb720188d8

8
dir.c
View File

@ -38,21 +38,17 @@ int
dir_create_dir(const char *dir, mode_t mode)
{
char copy[MAXPGPATH];
char *parent;
char parent[MAXPGPATH];
strncpy(copy, dir, MAXPGPATH);
parent = dirname(copy);
strncpy(parent, dirname(copy), MAXPGPATH);
/* Create parent first */
if (access(parent, F_OK) == -1)
dir_create_dir(parent, mode);
/* Create directory */
#ifdef __darwin__
if (mkdir(copy, mode) == -1)
#else
if (mkdir(dir, mode) == -1)
#endif
{
if (errno == EEXIST) /* already exist */
return 0;