Skip to content

Commit bfaba24

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 ca9cfed commit bfaba24

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/bin/pg_dump/pg_backup_db.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,12 @@ DisconnectDatabase(Archive *AHX)
360360
if (AH->connCancel)
361361
{
362362
/*
363-
* If we have an active query, send a cancel before closing. This is
364-
* of no use for a normal exit, but might be helpful during
365-
* exit_horribly().
363+
* If we have an active query, send a cancel before closing, ignoring
364+
* any errors. This is of no use for a normal exit, but might be
365+
* helpful during exit_horribly().
366366
*/
367367
if (PQtransactionStatus(AH->connection) == PQTRANS_ACTIVE)
368-
PQcancel(AH->connCancel, errbuf, sizeof(errbuf));
368+
(void) PQcancel(AH->connCancel, errbuf, sizeof(errbuf));
369369

370370
/*
371371
* Prevent signal handler from sending a cancel after this.

src/bin/scripts/vacuumdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ DisconnectDatabase(ParallelSlot *slot)
854854

855855
if ((cancel = PQgetCancel(slot->connection)))
856856
{
857-
PQcancel(cancel, errbuf, sizeof(errbuf));
857+
(void) PQcancel(cancel, errbuf, sizeof(errbuf));
858858
PQfreeCancel(cancel);
859859
}
860860
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy