postgres.git / summary / log / commit / refs

commit    e7226dc3eb39d91fb999d58ef52121dd3c8ee9fc
Author:   Alvaro Herrera <alvherre@alvh.no-ip.org>
Date:     Tue May 09 17:58:51 2017 +0000

    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.


src/bin/pg_dump/pg_backup_db.c | 8 ++++---- src/bin/scripts/vacuumdb.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index b01b174d9db..ce60b4db8aa 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -359,12 +359,12 @@ DisconnectDatabase(Archive *AHX) if (AH->connCancel) { /* - * If we have an active query, send a cancel before closing. This is - * of no use for a normal exit, but might be helpful during - * exit_horribly(). + * If we have an active query, send a cancel before closing, ignoring + * any errors. This is of no use for a normal exit, but might be + * helpful during exit_horribly(). */ 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. diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 2125f42c99d..3bb3f1bf1c1 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -853,7 +853,7 @@ DisconnectDatabase(ParallelSlot *slot) if ((cancel = PQgetCancel(slot->connection))) { - PQcancel(cancel, errbuf, sizeof(errbuf)); + (void) PQcancel(cancel, errbuf, sizeof(errbuf)); PQfreeCancel(cancel); } } [parent: aa3bcba08d46]