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

Commitbbd1e1c

Browse files
committed
Don't assume PQdb() will return a valid result from a failed connection.
1 parentb1f8a37 commitbbd1e1c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/bin/pg_dump/pg_backup_db.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*Implements the basic DB functions used by the archiver.
66
*
77
* IDENTIFICATION
8-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.58 2004/09/10 20:05:18 tgl Exp $
8+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.59 2004/10/01 17:25:55 tgl Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -174,12 +174,11 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, const char *requser)
174174

175175
if (noPwd||badPwd)
176176
{
177-
178177
if (badPwd)
179178
fprintf(stderr,"Password incorrect\n");
180179

181180
fprintf(stderr,"Connecting to %s as %s\n",
182-
PQdb(AH->connection),newuser);
181+
newdb,newuser);
183182

184183
need_pass= true;
185184
if (password)
@@ -189,6 +188,7 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, const char *requser)
189188
else
190189
die_horribly(AH,modulename,"could not reconnect to database: %s",
191190
PQerrorMessage(newConn));
191+
PQfinish(newConn);
192192
}
193193
}while (need_pass);
194194

@@ -266,7 +266,7 @@ ConnectDatabase(Archive *AHX,
266266
/* check to see that the backend connection was successfully made */
267267
if (PQstatus(AH->connection)==CONNECTION_BAD)
268268
die_horribly(AH,modulename,"connection to database \"%s\" failed: %s",
269-
PQdb(AH->connection),PQerrorMessage(AH->connection));
269+
dbname,PQerrorMessage(AH->connection));
270270

271271
/* check for version mismatch */
272272
_check_database_version(AH,ignoreVersion);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp