From a61a4773d612df945e7169e738fc6ccd35eb76d9 Mon Sep 17 00:00:00 2001
From: Andrey Rudometov <unlimitedhikari@gmail.com>
Date: Thu, 11 Dec 2025 12:13:11 +0700
Subject: [PATCH] Change createsubscriber's durable_rename to fe

---
 src/bin/pg_basebackup/pg_createsubscriber.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 85cfafbc069..ecb25747c3c 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -29,8 +29,7 @@
 #include "fe_utils/string_utils.h"
 #include "fe_utils/version.h"
 #include "getopt_long.h"
-#include "storage/fd.h"
-#include "utils/elog.h"
+#include "common/file_utils.h"
 
 #define	DEFAULT_SUB_PORT	"50432"
 #define	OBJECTTYPE_PUBLICATIONS  0x0001
@@ -200,7 +199,7 @@ cleanup_objects_atexit(void)
 			snprintf(filename_with_original_contents, MAXPGPATH,
 					 "%s" RECOVERY_CONF_PREFIX, filename);
 
-			err = durable_rename(filename_with_original_contents, filename, ERROR);
+			err = durable_rename(filename_with_original_contents, filename);
 		}
 		else					/* postgresql.auto.conf */
 		{
@@ -1345,11 +1344,14 @@ setup_recovery(const struct LogicalRepInfo *dbinfo, const char *datadir, const c
 		if (strcmp(recovery_conf_filename, "recovery.conf") == 0)
 		{
 			char		filename_with_original_contents[MAXPGPATH];
+			int			err = 0;
 
 			snprintf(filename_with_original_contents, MAXPGPATH,
 					 "%s" RECOVERY_CONF_PREFIX, filename);
 
-			durable_rename(filename, filename_with_original_contents, FATAL);
+			err = durable_rename(filename, filename_with_original_contents);
+			if (err)
+				pg_fatal("could not rename file \"%s\"", filename);
 		}
 
 		appendPQExpBuffer(recoveryconfcontents, "recovery_target_lsn = '%s'\n",
-- 
2.43.0

