]> granicus.if.org Git - postgresql/commitdiff
Ignore PQcancel errors properly
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 9 May 2017 17:58:51 +0000 (14:58 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 9 May 2017 17:58:51 +0000 (14:58 -0300)
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
src/bin/scripts/vacuumdb.c

index d2a3de3c5de2a19b0a3d3f4e61a714dfc165bc8b..1cf5a505e02f7525ddfe0f80577ba902676fdeb4 100644 (file)
@@ -360,12 +360,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.
index 32cb0fca2f2b34c126e2673b58c68ce0d8c9e9e3..b85c3088b34f15c1efbb040d5e5a277885a1581e 100644 (file)
@@ -854,7 +854,7 @@ DisconnectDatabase(ParallelSlot *slot)
 
                if ((cancel = PQgetCancel(slot->connection)))
                {
-                       PQcancel(cancel, errbuf, sizeof(errbuf));
+                       (void) PQcancel(cancel, errbuf, sizeof(errbuf));
                        PQfreeCancel(cancel);
                }
        }