From 55729429cbfe85e737312995cb7548a62a222405 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 31 Mar 2026 13:57:16 +0200 Subject: [PATCH v20 3/4] pg_createsubscriber: Remove separate logfile_open() function --- src/bin/pg_basebackup/pg_createsubscriber.c | 22 ++++----------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c index 5c5fa2a7633..e90fce0302e 100644 --- a/src/bin/pg_basebackup/pg_createsubscriber.c +++ b/src/bin/pg_basebackup/pg_createsubscriber.c @@ -975,22 +975,6 @@ server_is_in_recovery(PGconn *conn) return ret == 0; } -/* - * Open a new logfile with proper permissions. - */ -static FILE * -logfile_open(const char *filename, const char *mode) -{ - FILE *fh; - - fh = fopen(filename, mode); - - if (!fh) - pg_fatal("could not open log file \"%s\": %m", filename); - - return fh; -} - static void make_output_dirs(const char *log_basedir) { @@ -2530,8 +2514,10 @@ main(int argc, char **argv) make_output_dirs(opt.log_dir); internal_log_file = psprintf("%s/%s", logdir, INTERNAL_LOG_FILE_NAME); - /* logfile_open() will exit if there is an error */ - internal_log_file_fp = logfile_open(internal_log_file, "a"); + internal_log_file_fp = fopen(internal_log_file, "a"); + if (!internal_log_file_fp) + pg_fatal("could not open log file \"%s\": %m", internal_log_file); + pg_free(internal_log_file); pg_logging_set_logfile(internal_log_file_fp); -- 2.53.0