File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change 1414#include <dirent.h>
1515#include <sys/stat.h>
1616
17- /*
18- * selects function for scandir.
19- * Select all files except hidden.
20- */
21- static int selects (const struct dirent * dir )
22- {
23- return dir -> d_name [0 ] != '.' ;
24- }
25-
2617/*
2718 * Initialize backup catalog.
2819 */
@@ -31,14 +22,16 @@ do_init(void)
3122{
3223 char path [MAXPGPATH ];
3324 char arclog_path_dir [MAXPGPATH ];
34- struct dirent * * dp ;
3525 int results ;
3626
37- if (access (backup_path , F_OK ) == 0 )
27+ results = pg_check_dir (backup_path );
28+ if (results == 4 ) /* exists and not empty*/
29+ elog (ERROR , "backup catalog already exist and it's not empty" );
30+ else if (results == -1 ) /*trouble accessing directory*/
3831 {
39- results = scandir ( backup_path , & dp , selects , NULL ) ;
40- if ( results != 0 )
41- elog ( ERROR , "backup catalog already exist and it's not empty" );
32+ int errno_tmp = errno ;
33+ elog ( ERROR , "cannot open backup catalog directory \"%s\": %s" ,
34+ backup_path , strerror ( errno_tmp ) );
4235 }
4336
4437 /* create backup catalog root directory */
You can’t perform that action at this time.
0 commit comments