8000 Ignore PQcancel errors properly · markusborg/postgres@e7226dc · GitHub
[go: up one dir, main page]

Skip to content

Commit e7226dc

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 aa3bcba commit e7226dc

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
@@ -359,12 +359,12 @@ DisconnectDatabase(Archive *AHX)
359359
if (AH->connCancel)
360360
{
361361
/*
362-
* If we have an active query, send a cancel before closing. This is
363-
* of no use for a normal exit, but might be helpful during
364-
* exit_horribly().
362+
* If we have an active query, send a cancel before closing, ignoring
363+
* any errors. This is of no use for a normal exit, but might be
364+
* helpful during exit_horribly().
365365
*/
366366
if (PQtransactionStatus(AH->connection) == PQTRANS_ACTIVE)
367-
PQcancel(AH->connCancel, errbuf, sizeof(errbuf));
367+
(void) PQcancel(AH->connCancel, errbuf, sizeof(errbuf));
368368

369369
/*
370370
* 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
@@ -853,7 +853,7 @@ DisconnectDatabase(ParallelSlot *slot)
853853

854854
if ((cancel = PQgetCancel(slot->connection)))
855855
{
856-
PQcancel(cancel, errbuf, sizeof(errbuf));
856+
(void) PQcancel(cancel, errbuf, sizeof(errbuf));
857857
PQfreeCancel(cancel);
858858
}
859859
}

0 commit comments

Comments
 (0)
0