Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit84f878f

Browse files
committed
Don't use get_home_path so libpq doesn't pull path.c into the library.
1 parent76dd233 commit84f878f

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.160 2004/08/17 16:54:46 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.161 2004/08/19 00:00:34 momjian Exp $
33
-->
44

55
<chapter id="libpq">
@@ -136,7 +136,8 @@ PGconn *PQconnectdb(const char *conninfo);
136136
likely to fail if <application>libpq</application> is passed a host name
137137
that is not the name of the machine at <literal>hostaddr</>.) Also,
138138
<literal>host</> rather than <literal>hostaddr</> is used to identify
139-
the connection in <filename>$HOME/.pgpass</>.
139+
the connection in <filename>$HOME/.pgpass</> (or
140+
<filename>%USERPROFILE%/.pgpass</> on Win32).
140141
</para>
141142
<para>
142143
Without either a host name or host address,

‎src/interfaces/libpq/fe-connect.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.281 2004/08/18 02:59:11 momjian Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.282 2004/08/19 00:00:34 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -3093,7 +3093,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
30933093
{
30943094
FILE*fp;
30953095
char*pgpassfile;
3096-
charhome[MAXPGPATH];
3096+
char*home;
30973097
structstatstat_buf;
30983098

30993099
#defineLINELEN NAMEDATALEN*5
@@ -3111,18 +3111,25 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
31113111
if (port==NULL)
31123112
port=DEF_PGPORT_STR;
31133113

3114-
/* Look for it in the home dir */
3115-
if (!get_home_path(home))
3114+
/*
3115+
*Look for it in the home dir.
3116+
*We don't use get_home_path() so we don't pull path.c into our library.
3117+
*/
3118+
if (!(home=getenv(HOMEDIR)))
31163119
returnNULL;
3117-
3120+
31183121
pgpassfile=malloc(strlen(home)+1+strlen(PGPASSFILE)+1);
31193122
if (!pgpassfile)
31203123
{
31213124
fprintf(stderr,libpq_gettext("out of memory\n"));
31223125
returnNULL;
31233126
}
31243127

3128+
#ifndefWIN32
31253129
sprintf(pgpassfile,"%s/%s",home,PGPASSFILE);
3130+
#else
3131+
sprintf(pgpassfile,"%s\\%s",home,PGPASSFILE);
3132+
#endif
31263133

31273134
/* If password file cannot be opened, ignore it. */
31283135
if (stat(pgpassfile,&stat_buf)==-1)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp