mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
Don't use get_home_path so libpq doesn't pull path.c into the library.
This commit is contained in:
parent
76dd2333d5
commit
84f878f5cd
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.160 2004/08/17 16:54:46 momjian Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.161 2004/08/19 00:00:34 momjian Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="libpq">
|
<chapter id="libpq">
|
||||||
@ -136,7 +136,8 @@ PGconn *PQconnectdb(const char *conninfo);
|
|||||||
likely to fail if <application>libpq</application> is passed a host name
|
likely to fail if <application>libpq</application> is passed a host name
|
||||||
that is not the name of the machine at <literal>hostaddr</>.) Also,
|
that is not the name of the machine at <literal>hostaddr</>.) Also,
|
||||||
<literal>host</> rather than <literal>hostaddr</> is used to identify
|
<literal>host</> rather than <literal>hostaddr</> is used to identify
|
||||||
the connection in <filename>$HOME/.pgpass</>.
|
the connection in <filename>$HOME/.pgpass</> (or
|
||||||
|
<filename>%USERPROFILE%/.pgpass</> on Win32).
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Without either a host name or host address,
|
Without either a host name or host address,
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.281 2004/08/18 02:59:11 momjian Exp $
|
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.282 2004/08/19 00:00:34 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -3093,7 +3093,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
|
|||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *pgpassfile;
|
char *pgpassfile;
|
||||||
char home[MAXPGPATH];
|
char *home;
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
|
|
||||||
#define LINELEN NAMEDATALEN*5
|
#define LINELEN NAMEDATALEN*5
|
||||||
@ -3111,8 +3111,11 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
|
|||||||
if (port == NULL)
|
if (port == NULL)
|
||||||
port = DEF_PGPORT_STR;
|
port = DEF_PGPORT_STR;
|
||||||
|
|
||||||
/* Look for it in the home dir */
|
/*
|
||||||
if (!get_home_path(home))
|
* Look for it in the home dir.
|
||||||
|
* We don't use get_home_path() so we don't pull path.c into our library.
|
||||||
|
*/
|
||||||
|
if (!(home = getenv(HOMEDIR)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pgpassfile = malloc(strlen(home) + 1 + strlen(PGPASSFILE) + 1);
|
pgpassfile = malloc(strlen(home) + 1 + strlen(PGPASSFILE) + 1);
|
||||||
@ -3122,7 +3125,11 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
sprintf(pgpassfile, "%s/%s", home, PGPASSFILE);
|
sprintf(pgpassfile, "%s/%s", home, PGPASSFILE);
|
||||||
|
#else
|
||||||
|
sprintf(pgpassfile, "%s\\%s", home, PGPASSFILE);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If password file cannot be opened, ignore it. */
|
/* If password file cannot be opened, ignore it. */
|
||||||
if (stat(pgpassfile, &stat_buf) == -1)
|
if (stat(pgpassfile, &stat_buf) == -1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user