* 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. */
| 431 | * setup, however, we don't force the chdir to occur during SetDataDir. |
| 432 | */ |
| 433 | void |
| 434 | ChangeToDataDir(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 | /* ---------------------------------------------------------------- |
no test coverage detected