Commit e0bf1606 authored by Alvaro Herrera's avatar Alvaro Herrera

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.
parent 26aa1cf3
...@@ -351,12 +351,12 @@ DisconnectDatabase(Archive *AHX) ...@@ -351,12 +351,12 @@ DisconnectDatabase(Archive *AHX)
if (AH->connCancel) if (AH->connCancel)
{ {
/* /*
* If we have an active query, send a cancel before closing. This is * If we have an active query, send a cancel before closing, ignoring
* of no use for a normal exit, but might be helpful during * any errors. This is of no use for a normal exit, but might be
* exit_horribly(). * helpful during exit_horribly().
*/ */
if (PQtransactionStatus(AH->connection) == PQTRANS_ACTIVE) if (PQtransactionStatus(AH->connection) == PQTRANS_ACTIVE)
PQcancel(AH->connCancel, errbuf, sizeof(errbuf)); (void) PQcancel(AH->connCancel, errbuf, sizeof(errbuf));
/* /*
* Prevent signal handler from sending a cancel after this. * Prevent signal handler from sending a cancel after this.
......
...@@ -860,7 +860,7 @@ DisconnectDatabase(ParallelSlot *slot) ...@@ -860,7 +860,7 @@ DisconnectDatabase(ParallelSlot *slot)
if ((cancel = PQgetCancel(slot->connection))) if ((cancel = PQgetCancel(slot->connection)))
{ {
PQcancel(cancel, errbuf, sizeof(errbuf)); (void) PQcancel(cancel, errbuf, sizeof(errbuf));
PQfreeCancel(cancel); PQfreeCancel(cancel);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment