v20-0003-pg_createsubscriber-Remove-separate-logfile_open.patch
text/plain
Filename: v20-0003-pg_createsubscriber-Remove-separate-logfile_open.patch
Type: text/plain
Part: 2
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v20-0003
Subject: pg_createsubscriber: Remove separate logfile_open() function
| File | + | − |
|---|---|---|
| src/bin/pg_basebackup/pg_createsubscriber.c | 4 | 18 |
From 55729429cbfe85e737312995cb7548a62a222405 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
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