@@ -1483,7 +1483,7 @@ update_recovery_options_before_v12(InstanceState *instanceState, pgBackup *backu
14831483 }
14841484
14851485 elog (LOG , "update recovery settings in recovery.conf" );
1486- snprintf (path , lengthof ( path ) , "%s/ recovery.conf" , instance_config . pgdata );
1486+ join_path_components (path , instance_config . pgdata , "recovery.conf" );
14871487
14881488 fp = fio_fopen (path , "w" , FIO_DB_HOST );
14891489 if (fp == NULL )
@@ -1540,8 +1540,7 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
15401540
15411541 time2iso (current_time_str , lengthof (current_time_str ), current_time , false);
15421542
1543- snprintf (postgres_auto_path , lengthof (postgres_auto_path ),
1544- "%s/postgresql.auto.conf" , instance_config .pgdata );
1543+ join_path_components (postgres_auto_path , instance_config .pgdata , "postgresql.auto.conf" );
15451544
15461545 if (fio_stat (postgres_auto_path , & st , false, FIO_DB_HOST ) < 0 )
15471546 {
@@ -1651,7 +1650,7 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
16511650 if (params -> recovery_settings_mode == PITR_REQUESTED )
16521651 {
16531652 elog (LOG , "creating recovery.signal file" );
1654- snprintf (path , lengthof ( path ) , "%s/ recovery.signal" , instance_config . pgdata );
1653+ join_path_components (path , instance_config . pgdata , "recovery.signal" );
16551654
16561655 fp = fio_fopen (path , PG_BINARY_W , FIO_DB_HOST );
16571656 if (fp == NULL )
@@ -1667,7 +1666,7 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
16671666 if (params -> restore_as_replica )
16681667 {
16691668 elog (LOG , "creating standby.signal file" );
1670- snprintf (path , lengthof ( path ) , "%s/ standby.signal" , instance_config . pgdata );
1669+ join_path_components (path , instance_config . pgdata , "standby.signal" );
16711670
16721671 fp = fio_fopen (path , PG_BINARY_W , FIO_DB_HOST );
16731672 if (fp == NULL )
@@ -2163,7 +2162,7 @@ check_incremental_compatibility(const char *pgdata, uint64 system_identifier,
21632162 {
21642163 char pid_file [MAXPGPATH ];
21652164
2166- snprintf (pid_file , MAXPGPATH , "%s/ postmaster.pid" , pgdata );
2165+ join_path_components (pid_file , pgdata , "postmaster.pid" );
21672166 elog (WARNING , "Pid file \"%s\" is mangled, cannot determine whether postmaster is running or not" ,
21682167 pid_file );
21692168 success = false;
@@ -2204,7 +2203,7 @@ check_incremental_compatibility(const char *pgdata, uint64 system_identifier,
22042203 */
22052204 if (incremental_mode == INCR_LSN )
22062205 {
2207- snprintf (backup_label , MAXPGPATH , "%s/ backup_label" , pgdata );
2206+ join_path_components (backup_label , pgdata , "backup_label" );
22082207 if (fio_access (backup_label , F_OK , FIO_DB_HOST ) == 0 )
22092208 {
22102209 elog (WARNING , "Destination directory contains \"backup_control\" file. "
0 commit comments