@@ -37,8 +37,7 @@ catalog_lock(void)
37
37
int ret ;
38
38
char id_path [MAXPGPATH ];
39
39
40
- snprintf (id_path ,lengthof (id_path ),"%s/%s" ,backup_path ,
41
- PG_RMAN_INI_FILE );
40
+ join_path_components (id_path ,backup_path ,PG_RMAN_INI_FILE );
42
41
lock_fd = open (id_path ,O_RDWR );
43
42
if (lock_fd == -1 )
44
43
elog (errno == ENOENT ?ERROR_CORRUPTED :ERROR_SYSTEM ,
@@ -81,8 +80,8 @@ catalog_unlock(void)
81
80
pgBackup *
82
81
catalog_get_backup (time_t timestamp )
83
82
{
84
- pgBackup tmp ;
85
- char ini_path [MAXPGPATH ];
83
+ pgBackup tmp ;
84
+ char ini_path [MAXPGPATH ];
86
85
87
86
tmp .start_time = timestamp ;
88
87
pgBackupGetPath (& tmp ,ini_path ,lengthof (ini_path ),BACKUP_INI_FILE );
@@ -120,18 +119,18 @@ parray *
120
119
catalog_get_backup_list (const pgBackupRange * range )
121
120
{
122
121
const pgBackupRange range_all = {0 ,0 };
123
- DIR * date_dir = NULL ;
124
- struct dirent * date_ent = NULL ;
125
- DIR * time_dir = NULL ;
126
- struct dirent * time_ent = NULL ;
127
- char date_path [MAXPGPATH ];
128
- parray * backups = NULL ;
129
- pgBackup * backup = NULL ;
130
- struct tm * tm ;
131
- char begin_date [100 ];
132
- char begin_time [100 ];
133
- char end_date [100 ];
134
- char end_time [100 ];
122
+ DIR * date_dir = NULL ;
123
+ struct dirent * date_ent = NULL ;
124
+ DIR * time_dir = NULL ;
125
+ struct dirent * time_ent = NULL ;
126
+ char date_path [MAXPGPATH ];
127
+ parray * backups = NULL ;
128
+ pgBackup * backup = NULL ;
129
+ struct tm * tm ;
130
+ char begin_date [100 ];
131
+ char begin_time [100 ];
132
+ char end_date [100 ];
133
+ char end_time [100 ];
135
134
136
135
if (range == NULL )
137
136
range = & range_all ;
@@ -172,7 +171,7 @@ catalog_get_backup_list(const pgBackupRange *range)
172
171
continue ;
173
172
174
173
/* open subdirectory (date directory) and search time directory */
175
- snprintf (date_path , MAXPGPATH , "%s/%s" ,backup_path ,date_ent -> d_name );
174
+ join_path_components (date_path ,backup_path ,date_ent -> d_name );
176
175
time_dir = opendir (date_path );
177
176
if (time_dir == NULL )
178
177
{
@@ -291,8 +290,8 @@ catalog_get_last_arclog_backup(parray *backup_list)
291
290
pgBackup *
292
291
catalog_get_last_srvlog_backup (parray * backup_list )
293
292
{
294
- int i ;
295
- pgBackup * backup = NULL ;
293
+ int i ;
294
+ pgBackup * backup = NULL ;
296
295
297
296
/* backup_list is sorted in order of descending ID */
298
297
for (i = 0 ;i < parray_num (backup_list );i ++ )
@@ -311,9 +310,9 @@ catalog_get_last_srvlog_backup(parray *backup_list)
311
310
int
312
311
pgBackupCreateDir (pgBackup * backup )
313
312
{
314
- int i ;
315
- char path [MAXPGPATH ];
316
- char * subdirs []= {DATABASE_DIR ,ARCLOG_DIR ,SRVLOG_DIR ,NULL };
313
+ int i ;
314
+ char path [MAXPGPATH ];
315
+ char * subdirs []= {DATABASE_DIR ,ARCLOG_DIR ,SRVLOG_DIR ,NULL };
317
316
318
317
pgBackupGetPath (backup ,path ,lengthof (path ),NULL );
319
318
dir_create_dir (path ,DIR_PERMISSION );
@@ -377,8 +376,8 @@ pgBackupWriteResultSection(FILE *out, pgBackup *backup)
377
376
void
378
377
pgBackupWriteIni (pgBackup * backup )
379
378
{
380
- FILE * fp = NULL ;
381
- char ini_path [MAXPGPATH ];
379
+ FILE * fp = NULL ;
380
+ char ini_path [MAXPGPATH ];
382
381
383
382
pgBackupGetPath (backup ,ini_path ,lengthof (ini_path ),BACKUP_INI_FILE );
384
383
fp = fopen (ini_path ,"wt" );
@@ -561,8 +560,8 @@ pgBackupCompareIdDesc(const void *l, const void *r)
561
560
void
562
561
pgBackupGetPath (const pgBackup * backup ,char * path ,size_t len ,const char * subdir )
563
562
{
564
- char datetime [20 ];
565
- struct tm * tm ;
563
+ char datetime [20 ];
564
+ struct tm * tm ;
566
565
567
566
/* generate $BACKUP_PATH/date/time path */
568
567
tm = localtime (& backup -> start_time );