1
0
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:
Marc G. Fournier
1997-12-07 20:57:45 +00:00
parent a68a132a6c
commit bec35da8bf
2 changed files with 13 additions and 4 deletions

View File

@ -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);
}