@ -193,7 +193,6 @@ static const char *backend_options = "--single -F -O -j -c search_path=pg_catalo
static const char * const subdirs [ ] = {
" global " ,
" pg_xlog " ,
" pg_xlog/archive_status " ,
" pg_clog " ,
" pg_commit_ts " ,
@ -280,7 +279,7 @@ void setup_locale_encoding(void);
void setup_signals ( void ) ;
void setup_text_search ( void ) ;
void create_data_directory ( void ) ;
void create_xlog_symlink ( void ) ;
void create_xlog_or_ symlink ( void ) ;
void warn_on_mount_point ( int error ) ;
void initialize_data_directory ( void ) ;
@ -2948,13 +2947,17 @@ create_data_directory(void)
}
/* Create transaction log directory, and symlink if required */
void
create_xlog_symlink ( void )
create_xlog_or_ symlink ( void )
{
/* Create transaction log symlink, if required */
char * subdirloc ;
/* form name of the place for the subdirectory or symlink */
subdirloc = psprintf ( " %s/pg_xlog " , pg_data ) ;
if ( strcmp ( xlog_dir , " " ) ! = 0 )
{
char * linkloc ;
int ret ;
/* clean up xlog directory name, check it's absolute */
@ -3027,22 +3030,30 @@ create_xlog_symlink(void)
exit_nicely ( ) ;
}
/* form name of the place where the symlink must go */
linkloc = psprintf ( " %s/pg_xlog " , pg_data ) ;
# ifdef HAVE_SYMLINK
if ( symlink ( xlog_dir , link loc) ! = 0 )
if ( symlink ( xlog_dir , subdirloc ) ! = 0 )
{
fprintf ( stderr , _ ( " %s: could not create symbolic link \" %s \" : %s \n " ) ,
progname , link loc, strerror ( errno ) ) ;
progname , subdir loc, strerror ( errno ) ) ;
exit_nicely ( ) ;
}
# else
fprintf ( stderr , _ ( " %s: symlinks are not supported on this platform " ) ) ;
exit_nicely ( ) ;
# endif
free ( linkloc ) ;
}
else
{
/* Without -X option, just make the subdirectory normally */
if ( mkdir ( subdirloc , S_IRWXU ) < 0 )
{
fprintf ( stderr , _ ( " %s: could not create directory \" %s \" : %s \n " ) ,
progname , subdirloc , strerror ( errno ) ) ;
exit_nicely ( ) ;
}
}
free ( subdirloc ) ;
}
@ -3074,9 +3085,9 @@ initialize_data_directory(void)
create_data_directory ( ) ;
create_xlog_symlink ( ) ;
create_xlog_or_ symlink ( ) ;
/* Create required subdirectories */
/* Create required subdirectories (other than pg_xlog) */
printf ( _ ( " creating subdirectories ... " ) ) ;
fflush ( stdout ) ;