src/backend/utils/init/miscinit.c
/*
 * Change working directory to DataDir.  Most of the postmaster and backend
 * code assumes that we are in DataDir so it can use relative paths to access
 * stuff in and under the data directory.  For convenience during path
 * setup, however, we don't force the chdir to occur during SetDataDir.
 */
Change working directory to DataDir.  Most of the postmaster and backend
code assumes that we are in DataDir so it can use relative paths to access
stuff in and under the data directory.  For convenience during path
setup, however, we don't force the chdir to occur during SetDataDir.
Change working directory to DataDir . Most of the postmaster and backend code assumes that we are in DataDir so it can use relative paths to access stuff in and under the data directory . For convenience during path setup however we don ' t force the chdir to occur during SetDataDir .
void
ChangeToDataDir(void)
{
	AssertState(DataDir);
	if (chdir(DataDir) < 0)
		ereport(FATAL,
				(errcode_for_file_access(),
				 errmsg("could not change directory to \"%s\": %m",
						DataDir)));
}
void ChangeToDataDir ( void ) { AssertState ( DataDir ) ; if ( chdir ( DataDir ) < 0 ) ereport ( FATAL , ( errcode_for_file_access ( ) , errmsg ( " \" \" " , DataDir ) ) ) ; }
Change working directory to DataDir.
Change working directory to DataDir .