44 if (calling_file != NULL)
46 strlcpy(abs_path, calling_file,
sizeof(abs_path));
71 int elevel,
int *num_filenames,
char **err_msg)
76 char **filenames = NULL;
84 if (strspn(includedir,
" \t\r\n") == strlen(includedir))
87 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
88 errmsg(
"empty configuration directory name: \"%s\"",
90 *err_msg =
"empty configuration directory name";
100 errmsg(
"could not open configuration directory \"%s\": %m",
111 filenames = (
char **)
palloc(size_filenames *
sizeof(
char *));
124 if (strlen(de->
d_name) < 6)
128 if (strcmp(de->
d_name + strlen(de->
d_name) - 5,
".conf") != 0)
144 if (*num_filenames >= size_filenames)
146 size_filenames += 32;
147 filenames = (
char **)
repalloc(filenames,
148 size_filenames *
sizeof(
char *));
156 if (*num_filenames > 0)
static void cleanup(void)
char * AbsoluteConfigLocation(const char *location, const char *calling_file)
char ** GetConfFilesInDir(const char *includedir, const char *calling_file, int elevel, int *num_filenames, char **err_msg)
int errcode_for_file_access(void)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
DIR * AllocateDir(const char *dirname)
struct dirent * ReadDir(DIR *dir, const char *dirname)
PGFileType get_dirent_type(const char *path, const struct dirent *de, bool look_through_symlinks, int elevel)
Assert(PointerIsAligned(start, uint64))
char * pstrdup(const char *in)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
void join_path_components(char *ret_path, const char *head, const char *tail)
#define is_absolute_path(filename)
void canonicalize_path(char *path)
int pg_qsort_strcmp(const void *a, const void *b)
void get_parent_directory(char *path)
#define qsort(a, b, c, d)
size_t strlcpy(char *dst, const char *src, size_t siz)
char * psprintf(const char *fmt,...)
static const char * directory