From e9ccc54a4cd2f73bf027b069efa637683bfbcc09 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 31 Mar 2026 13:57:52 +0200 Subject: [PATCH v20 4/4] pg_createsubscriber: Don't use MAXPGPATH --- src/bin/pg_basebackup/pg_createsubscriber.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c index e90fce0302e..15e06e5686e 100644 --- a/src/bin/pg_basebackup/pg_createsubscriber.c +++ b/src/bin/pg_basebackup/pg_createsubscriber.c @@ -172,7 +172,7 @@ static pg_prng_state prng_state; static char *pg_ctl_path = NULL; static char *pg_resetwal_path = NULL; -static char logdir[MAXPGPATH]; /* Subdirectory of the user specified logdir +static char *logdir = NULL; /* Subdirectory of the user specified logdir * where the log files are written (if * specified) */ @@ -982,7 +982,6 @@ make_output_dirs(const char *log_basedir) struct timeval tval; time_t now; struct tm tmbuf; - int len; /* Generate timestamp */ gettimeofday(&tval, NULL); @@ -997,10 +996,7 @@ make_output_dirs(const char *log_basedir) (unsigned int) (tval.tv_usec / 1000)); /* Build timestamp directory path */ - len = snprintf(logdir, MAXPGPATH, "%s/%s", log_basedir, timestamp); - - if (len >= MAXPGPATH) - pg_fatal("directory path for log files is too long"); + logdir = psprintf("%s/%s", log_basedir, timestamp); /* Create base directory (ignore if exists) */ if (mkdir(log_basedir, pg_dir_create_mode) < 0 && errno != EEXIST) -- 2.53.0