@@ -654,7 +654,7 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
654
654
while (i < parray_num (files ))
655
655
{
656
656
pgFile * file = (pgFile * )parray_get (files ,i );
657
- char * path = file -> path ;
657
+ char * path = file -> path ;/* for streamed WAL files */
658
658
char line [BLCKSZ ];
659
659
int len = 0 ;
660
660
@@ -667,13 +667,13 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
667
667
if (S_ISREG (file -> mode )&& file -> write_size > 0 )
668
668
backup_size_on_disk += file -> write_size ;
669
669
670
- if ( file -> external_dir_num && external_list )
671
- {
672
- path = GetRelativePath ( path , parray_get ( external_list ,
673
- file -> external_dir_num - 1 ));
674
- }
675
- else
676
- path = file -> rel_path ;
670
+ /* for files from PGDATA and external files use rel_path
671
+ * streamed WAL files has rel_path relative not to "database/"
672
+ * but to "database/pg_wal", so for them use path.
673
+ */
674
+ if (( root && strstr ( path , root ) == path ) ||
675
+ ( file -> external_dir_num && external_list ))
676
+ path = file -> rel_path ;
677
677
678
678
len = sprintf (line ,"{\"path\":\"%s\", \"size\":\"" INT64_FORMAT "\", "
679
679
"\"mode\":\"%u\", \"is_datafile\":\"%u\", "