]> 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

index ad76cdbbe95a9edeb40168bd3b8ffe3660d04c61..60e9deaba73f0fed53b20e4b3416006e5c1e4525 100644 (file)
@@ -342,12 +342,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.