summaryrefslogtreecommitdiff
path: root/src/backend/libpq/hba.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-08-27 21:50:18 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-08-27 21:50:18 +0000
commit4c8d2f7f7b129d8fd679bb970345593ac6190725 (patch)
treeba9c8e190a82c8eb32c38ec1bb6da7c2487d19da /src/backend/libpq/hba.c
parent5ba9d8c2d45e745d72666b5befabea0300168daa (diff)
Clean up callers of AllocateFile and BasicOpenFile to ensure that
a reasonable error message (including the kernel errno message) is reported on any file open failure.
Diffstat (limited to 'src/backend/libpq/hba.c')
-rw-r--r--src/backend/libpq/hba.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index dca3cf4fc3c..5dbf7d61db9 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -5,7 +5,7 @@
* wherein you authenticate a user by seeing what IP address the system
* says he comes from and possibly using ident).
*
- * $Id: hba.c,v 1.53 2000/07/08 03:04:39 tgl Exp $
+ * $Id: hba.c,v 1.54 2000/08/27 21:50:18 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -427,10 +427,8 @@ find_hba_entry(hbaPort *port, bool *hba_ok_p)
/* The open of the config file failed. */
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
- "find_hba_entry: Host-based authentication config file "
- "does not exist or permissions are not setup correctly! "
- "Unable to open file \"%s\".\n",
- conf_file);
+ "find_hba_entry: Unable to open authentication config file \"%s\": %s\n",
+ conf_file, strerror(errno));
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
}
@@ -812,16 +810,13 @@ verify_against_usermap(const char *pguser,
{
/* The open of the map file failed. */
- *checks_out_p = false;
-
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
- "verify_against_usermap: usermap file for Ident-based "
- "authentication "
- "does not exist or permissions are not setup correctly! "
- "Unable to open file \"%s\".\n",
- map_file);
+ "verify_against_usermap: Unable to open usermap file \"%s\": %s\n",
+ map_file, strerror(errno));
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
+
+ *checks_out_p = false;
}
else
{
@@ -981,7 +976,10 @@ GetCharSetByHost(char *TableName, int host, const char *DataDir)
snprintf(map_file, bufsize, "%s/%s", DataDir, CHARSET_FILE);
file = AllocateFile(map_file, PG_BINARY_R);
if (file == NULL)
+ {
+ /* XXX should we log a complaint? */
return;
+ }
while (!eof)
{
c = getc(file);