1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Add get_home_path() to use USERPROFILE on Win32 and HOME on Unix.

This commit is contained in:
Bruce Momjian
2004-08-18 02:59:12 +00:00
parent 19cd31b068
commit 1abf13db3c
6 changed files with 47 additions and 25 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.280 2004/08/17 04:24:23 tgl Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.281 2004/08/18 02:59:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -3093,7 +3093,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
{
FILE *fp;
char *pgpassfile;
char *home;
char home[MAXPGPATH];
struct stat stat_buf;
#define LINELEN NAMEDATALEN*5
@ -3112,8 +3112,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
port = DEF_PGPORT_STR;
/* Look for it in the home dir */
home = getenv("HOME");
if (!home)
if (!get_home_path(home))
return NULL;
pgpassfile = malloc(strlen(home) + 1 + strlen(PGPASSFILE) + 1);