@@ -391,7 +391,7 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
391391 pgFile * file = (pgFile * ) parray_get (backup_files_list , i );
392392
393393 /* if the entry was a directory, create it in the backup */
394- if (S_ISDIR ( file -> mode ) )
394+ if (file -> kind == PIO_KIND_DIRECTORY )
395395 {
396396 char dirpath [MAXPGPATH ];
397397
@@ -568,7 +568,7 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
568568 pgFile * file = (pgFile * ) parray_get (backup_files_list , i );
569569
570570 /* TODO: sync directory ? */
571- if (S_ISDIR ( file -> mode ) )
571+ if (file -> kind == PIO_KIND_DIRECTORY )
572572 continue ;
573573
574574 if (file -> write_size <= 0 )
@@ -1836,7 +1836,7 @@ pg_stop_backup_write_file_helper(const char *path, const char *filename, const c
18361836 file = pgFileNew (full_filename , filename , true, 0 ,
18371837 FIO_BACKUP_HOST );
18381838
1839- if (S_ISREG ( file -> mode ) )
1839+ if (file -> kind == PIO_KIND_REGULAR )
18401840 {
18411841 file -> crc = pgFileGetCRC32C (full_filename , false);
18421842
@@ -1990,7 +1990,7 @@ backup_files(void *arg)
19901990 pgFile * prev_file = NULL ;
19911991
19921992 /* We have already copied all directories */
1993- if (S_ISDIR ( file -> mode ) )
1993+ if (file -> kind == PIO_KIND_DIRECTORY )
19941994 continue ;
19951995
19961996 if (arguments -> thread_num == 1 )
@@ -2045,9 +2045,9 @@ backup_files(void *arg)
20452045 }
20462046
20472047 /* Encountered some strange beast */
2048- if (! S_ISREG ( file -> mode ) )
2049- elog (WARNING , "Unexpected type %d of file \"%s\", skipping" ,
2050- file -> mode , from_fullpath );
2048+ if (file -> kind != PIO_KIND_REGULAR )
2049+ elog (WARNING , "Unexpected type %s of file \"%s\", skipping" ,
2050+ pio_file_kind2str ( file -> kind , from_fullpath ) , from_fullpath );
20512051
20522052 /* Check that file exist in previous backup */
20532053 if (current .backup_mode != BACKUP_MODE_FULL )
@@ -2120,7 +2120,7 @@ parse_filelist_filenames(parray *files, const char *root)
21202120 pgFile * file = (pgFile * ) parray_get (files , i );
21212121 int sscanf_result ;
21222122
2123- if (S_ISREG ( file -> mode ) &&
2123+ if (file -> kind == PIO_KIND_REGULAR &&
21242124 path_is_prefix_of_path (PG_TBLSPC_DIR , file -> rel_path ))
21252125 {
21262126 /*
@@ -2147,7 +2147,7 @@ parse_filelist_filenames(parray *files, const char *root)
21472147 }
21482148 }
21492149
2150- if (S_ISREG ( file -> mode ) && file -> tblspcOid != 0 &&
2150+ if (file -> kind == PIO_KIND_REGULAR && file -> tblspcOid != 0 &&
21512151 file -> name && file -> name [0 ])
21522152 {
21532153 if (file -> forkName == init )
@@ -2217,7 +2217,7 @@ set_cfs_datafiles(parray *files, const char *root, char *relative, size_t i)
22172217
22182218 if (strstr (prev_file -> rel_path , cfs_tblspc_path ) != NULL )
22192219 {
2220- if (S_ISREG ( prev_file -> mode ) && prev_file -> is_datafile )
2220+ if (prev_file -> kind == PIO_KIND_REGULAR && prev_file -> is_datafile )
22212221 {
22222222 elog (LOG , "Setting 'is_cfs' on file %s, name %s" ,
22232223 prev_file -> rel_path , prev_file -> name );
@@ -2374,7 +2374,7 @@ calculate_datasize_of_filelist(parray *filelist)
23742374 if (file -> external_dir_num != 0 || file -> excluded )
23752375 continue ;
23762376
2377- if (S_ISDIR ( file -> mode ) )
2377+ if (file -> kind == PIO_KIND_DIRECTORY )
23782378 {
23792379 // TODO is a dir always 4K?
23802380 bytes += 4096 ;
0 commit comments