diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index e9fc0af7c9..a9f87ab5bf 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -41,6 +41,7 @@ #include "storage/fd.h" #include "utils/acl.h" #include "utils/builtins.h" +#include "utils/conffiles.h" #include "utils/guc.h" #include "utils/lsyscache.h" #include "utils/memutils.h" @@ -466,21 +467,7 @@ tokenize_inc_file(List *tokens, ListCell *inc_line; MemoryContext linecxt; - if (is_absolute_path(inc_filename)) - { - /* absolute path is taken as-is */ - inc_fullname = pstrdup(inc_filename); - } - else - { - /* relative path is relative to dir of calling file */ - inc_fullname = (char *) palloc(strlen(outer_filename) + 1 + - strlen(inc_filename) + 1); - strcpy(inc_fullname, outer_filename); - get_parent_directory(inc_fullname); - join_path_components(inc_fullname, inc_fullname, inc_filename); - canonicalize_path(inc_fullname); - } + inc_fullname = AbsoluteConfigLocation(inc_filename, outer_filename); inc_file = AllocateFile(inc_fullname, "r"); if (inc_file == NULL) diff --git a/src/backend/utils/misc/conffiles.c b/src/backend/utils/misc/conffiles.c index 4a99a1961e..027d481df8 100644 --- a/src/backend/utils/misc/conffiles.c +++ b/src/backend/utils/misc/conffiles.c @@ -35,12 +35,12 @@ char * AbsoluteConfigLocation(const char *location, const char *calling_file) { - char abs_path[MAXPGPATH]; - if (is_absolute_path(location)) return pstrdup(location); else { + char abs_path[MAXPGPATH]; + if (calling_file != NULL) { strlcpy(abs_path, calling_file, sizeof(abs_path));