]> granicus.if.org Git - postgresql/commitdiff
The following patch makes postmaster -D work. -D specifies a different PGDATA
authorMarc G. Fournier <scrappy@hub.org>
Mon, 26 Aug 1996 20:35:29 +0000 (20:35 +0000)
committerMarc G. Fournier <scrappy@hub.org>
Mon, 26 Aug 1996 20:35:29 +0000 (20:35 +0000)
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

src/backend/libpq/auth.c
src/backend/postmaster/postmaster.c

index 7b4437736f44214b3b2219e45b9b834df3f8e8d6..b5bfcf2ae7142da2fd0748e793c607b903b8c92f 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.1.1.1 1996/07/09 06:21:30 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.1.1.1.2.1 1996/08/26 20:34:49 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -403,11 +403,8 @@ hba_recvauth(struct sockaddr_in *addr, PacketBuf *pbuf, StartupInfo *sp)
     char *conf_file;
 
     /* put together the full pathname to the config file */
-    conf_file = (char *) malloc((strlen(GetPGData())+strlen(CONF_FILE)+2)*sizeof(char));
-    strcpy(conf_file, GetPGData());
-    strcat(conf_file, "/");
-    strcat(conf_file, CONF_FILE);
-    
+    conf_file = (char *) malloc((strlen(DataDir)+strlen(CONF_FILE)+2)*sizeof(char));
+    sprintf(conf_file, "%s/%s", DataDir, CONF_FILE);
 
     /* Open the config file. */
     file = fopen(conf_file, "r");
@@ -463,7 +460,10 @@ hba_recvauth(struct sockaddr_in *addr, PacketBuf *pbuf, StartupInfo *sp)
     }
     else 
     {  (void) sprintf(PQerrormsg,
-                          "hba_recvauth: config file does not exist or permissions are not setup correctly!\n");
+                      "hba_recvauth: Host-based authentication config file "
+                      "does not exist or permissions are not setup correctly! "
+                      "Unable to open file \"%s\".\n", 
+                      conf_file);
            fputs(PQerrormsg, stderr);
            pqdebug("%s", PQerrormsg);
        free(conf_file);
index 570f7243fe41ae1eb17c43c70620007734336b68..3d787b88fc447699f6f7d56b3d2a27d31366518d 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.3 1996/07/23 02:23:47 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.3.2.1 1996/08/26 20:35:29 scrappy Exp $
  *
  * NOTES
  *
@@ -1106,8 +1106,10 @@ checkDataDir()
     sprintf(path, "%s%cbase%ctemplate1%cpg_class", DataDir, SEP_CHAR, SEP_CHAR,
            SEP_CHAR);
     if ((fp=fopen(path, "r")) == NULL) {
-       fprintf(stderr, "%s: data base not found in directory \"%s\"\n",
-               progname, DataDir);
+        fprintf(stderr, "%s does not find the database.  Expected to find it "
+                "in the PGDATA directory \"%s\", but unable to open directory "
+                "with pathname \"%s\".\n", 
+                progname, DataDir, path);
        exit(2);
     }
     fclose(fp);