Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 80d0c4f

Browse files
committed
The following patch makes postmaster -D work. -D specifies a different PGDATA
directory. The code that looks for the pg_hba file doesn't use it, though, so the postmaster uses the wrong pg_hba file. Also, when the postmaster looks in one directory and the user thinks it is looking in another directory, the error messages don't give enough information to solve the problem. I extended the error message for this. Submitted by: Bryan Henderson <bryanh@giraffe.netgate.net>
1 parent ca5db6c commit 80d0c4f

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/backend/libpq/auth.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.1.1.1 1996/07/09 06:21:30 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.2 1996/08/14 04:51:02 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -403,11 +403,8 @@ hba_recvauth(struct sockaddr_in *addr, PacketBuf *pbuf, StartupInfo *sp)
403403
char *conf_file;
404404

405405
/* put together the full pathname to the config file */
406-
conf_file = (char *) malloc((strlen(GetPGData())+strlen(CONF_FILE)+2)*sizeof(char));
407-
strcpy(conf_file, GetPGData());
408-
strcat(conf_file, "/");
409-
strcat(conf_file, CONF_FILE);
410-
406+
conf_file = (char *) malloc((strlen(DataDir)+strlen(CONF_FILE)+2)*sizeof(char));
407+
sprintf(conf_file, "%s/%s", DataDir, CONF_FILE);
411408

412409
/* Open the config file. */
413410
file = fopen(conf_file, "r");
@@ -463,7 +460,10 @@ hba_recvauth(struct sockaddr_in *addr, PacketBuf *pbuf, StartupInfo *sp)
463460
}
464461
else
465462
{ (void) sprintf(PQerrormsg,
466-
"hba_recvauth: config file does not exist or permissions are not setup correctly!\n");
463+
"hba_recvauth: Host-based authentication config file "
464+
"does not exist or permissions are not setup correctly! "
465+
"Unable to open file \"%s\".\n",
466+
conf_file);
467467
fputs(PQerrormsg, stderr);
468468
pqdebug("%s", PQerrormsg);
469469
free(conf_file);

src/backend/postmaster/postmaster.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.4 1996/08/06 16:43:24 scrappy Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.5 1996/08/14 04:51:34 scrappy Exp $
1414
*
1515
* NOTES
1616
*
@@ -1110,8 +1110,10 @@ checkDataDir()
11101110
sprintf(path, "%s%cbase%ctemplate1%cpg_class", DataDir, SEP_CHAR, SEP_CHAR,
11111111
SEP_CHAR);
11121112
if ((fp=fopen(path, "r")) == NULL) {
1113-
fprintf(stderr, "%s: data base not found in directory \"%s\"\n",
1114-
progname, DataDir);
1113+
fprintf(stderr, "%s does not find the database. Expected to find it "
1114+
"in the PGDATA directory \"%s\", but unable to open directory "
1115+
"with pathname \"%s\".\n",
1116+
progname, DataDir, path);
11151117
exit(2);
11161118
}
11171119
fclose(fp);

0 commit comments

Comments
 (0)