From 72daa38baa6313ef78e9eac966b61d0ef0539ae2 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 14 Aug 2019 20:28:05 +0900 Subject: [PATCH] durable_rename() only available externally from Pg10 --- configfile.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/configfile.c b/configfile.c index d7a5224c..76d19532 100644 --- a/configfile.c +++ b/configfile.c @@ -24,7 +24,10 @@ #include "log.h" #include + +#if (PG_ACTUAL_VERSION_NUM >= 100000) #include /* for durable_rename() */ +#endif const static char *_progname = NULL; char config_file_path[MAXPGPATH] = ""; @@ -1882,6 +1885,8 @@ modify_auto_conf(const char *data_dir) KeyValueList config = {NULL, NULL}; KeyValueListCell *cell = NULL; + bool success = true; + initPQExpBuffer(&auto_conf); appendPQExpBuffer(&auto_conf, "%s/%s", data_dir, PG_AUTOCONF_FILENAME); @@ -1938,7 +1943,15 @@ modify_auto_conf(const char *data_dir) { fclose(fp); + // XXX check return values +#if (PG_ACTUAL_VERSION_NUM >= 100000) (void) durable_rename(auto_conf_tmp.data, auto_conf.data, LOG); +#else + if (rename(auto_conf_tmp.data, auto_conf.data) < 0) + { + success = false; + } +#endif } } @@ -1948,7 +1961,7 @@ modify_auto_conf(const char *data_dir) key_value_list_free(&config); - return true; + return success; }