MCPcopy Create free account
hub / github.com/apache/cloudberry / ChangeToDataDir

Function ChangeToDataDir

src/backend/utils/init/miscinit.c:433–443  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

431 * setup, however, we don't force the chdir to occur during SetDataDir.
432 */
433void
434ChangeToDataDir(void)
435{
436 AssertState(DataDir);
437
438 if (chdir(DataDir) < 0)
439 ereport(FATAL,
440 (errcode_for_file_access(),
441 errmsg("could not change directory to \"%s\": %m",
442 DataDir)));
443}
444
445
446/* ----------------------------------------------------------------

Callers 3

PostgresMainFunction · 0.85
PostmasterMainFunction · 0.85
AuxiliaryProcessMainFunction · 0.85

Calls 2

errcode_for_file_accessFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected