mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-24 23:56:29 +00:00
Merge commit '3ef1fa126d9c9b9ba3b29deab7f67218cdf7ce10'
Conflicts: .gitignore Makefile README.rst check_dir.c config.c config.h dbutils.h repmgr.c repmgr.conf repmgr.h repmgrd.c
This commit is contained in:
16
check_dir.c
16
check_dir.c
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* check_dir.c - Directories management functions
|
||||
* Copyright (C) 2ndQuadrant, 2011
|
||||
* Copyright (C) 2ndQuadrant, 2010-2011
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -24,9 +24,12 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* NB: postgres_fe must be included BEFORE check_dir */
|
||||
#include "postgres_fe.h"
|
||||
#include "check_dir.h"
|
||||
|
||||
#include "strutil.h"
|
||||
|
||||
|
||||
static int mkdir_p(char *path, mode_t omode);
|
||||
|
||||
@@ -64,7 +67,7 @@ check_dir(char *dir)
|
||||
}
|
||||
else
|
||||
{
|
||||
result = 2; /* not empty */
|
||||
result = 2; /* not empty */
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -111,7 +114,7 @@ set_directory_permissions(char *dir)
|
||||
|
||||
|
||||
/* function from initdb.c */
|
||||
/* source stolen from FreeBSD /src/bin/mkdir/mkdir.c and adapted */
|
||||
/* source adapted from FreeBSD /src/bin/mkdir/mkdir.c */
|
||||
|
||||
/*
|
||||
* this tries to build all the elements of a path to a directory a la mkdir -p
|
||||
@@ -219,10 +222,11 @@ mkdir_p(char *path, mode_t omode)
|
||||
bool
|
||||
is_pg_dir(char *dir)
|
||||
{
|
||||
char path[8192];
|
||||
struct stat sb;
|
||||
const size_t buf_sz = 8192;
|
||||
char path[buf_sz];
|
||||
struct stat sb;
|
||||
|
||||
sprintf(path, "%s/PG_VERSION", dir);
|
||||
xsnprintf(path, buf_sz, "%s/PG_VERSION", dir);
|
||||
|
||||
return (stat(path, &sb) == 0) ? true : false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user