From 982af2a565e1a81362a1fc1893b2dbaf81049f2e Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Mon, 7 Nov 2022 12:55:39 +0900 Subject: [PATCH v16 1/3] Expand the use of AbsoluteConfigLocation() in hba.c The logic in charge of expanding an include file for database and user names used the same code as AbsoluteConfigLocation() when building the configuration file to include, so simplify this code. --- src/backend/libpq/hba.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) 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) -- 2.38.1