]> git.ipfire.org Git - thirdparty/postgresql.git/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 b01b174d9db64fc67b32c781530b2a9a27100f67..ce60b4db8aa1d8bb0f10b4cf33ffef76b78569b4 100644 (file)
@@ -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.
index 2125f42c99d47c1fceaf7cb9edab00e88528427c..3bb3f1bf1c1014cf38bc43e5805274501526c7cf 100644 (file)
@@ -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);
                }
        }