Skip to content

Commit 345bf97

Browse files
committed
Ignore PQcancel errors properly
Add a (void) cast to all PQcancel() calls that purposefully don't check the return value, to keep compilers and static checkers happy. Per Coverity.
1 parent 57811b7 commit 345bf97

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
@@ -342,12 +342,12 @@ DisconnectDatabase(Archive *AHX)
342342
if (AH->connCancel)
343343
{
344344
/*
345-
* If we have an active query, send a cancel before closing. This is
346-
* of no use for a normal exit, but might be helpful during
347-
* exit_horribly().
345+
* If we have an active query, send a cancel before closing, ignoring
346+
* any errors. This is of no use for a normal exit, but might be
347+
* helpful during exit_horribly().
348348
*/
349349
if (PQtransactionStatus(AH->connection) == PQTRANS_ACTIVE)
350-
PQcancel(AH->connCancel, errbuf, sizeof(errbuf));
350+
(void) PQcancel(AH->connCancel, errbuf, sizeof(errbuf));
351351

352352
/*
353353
* Prevent signal handler from sending a cancel after this.

0 commit comments

Comments
 (0)