mirror of
https://github.com/postgres/postgres.git
synced 2025-07-18 17:42:25 +03:00
Add error check on getenv("DATADIR")
Add code to set DATADIR in postmaster.c if -D is used
This commit is contained in:
@ -25,9 +25,13 @@ char* crypt_getpwdfilename() {
|
||||
static char* filename = NULL;
|
||||
|
||||
if (!filename) {
|
||||
char* env;
|
||||
char* env = NULL;
|
||||
|
||||
env = getenv("PGDATA");
|
||||
if(env == NULL) {
|
||||
elog(FATAL, "crypt.c: PGDATA is not defined");
|
||||
exit(-1);
|
||||
}
|
||||
filename = (char*)malloc(strlen(env) + strlen(CRYPT_PWD_FILE) + 2);
|
||||
sprintf(filename, "%s/%s", env, CRYPT_PWD_FILE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user