]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
psql: Don't give errors with epoll if db connection gets closed.
authorTimo Sirainen <tss@iki.fi>
Mon, 12 Jan 2009 17:05:19 +0000 (12:05 -0500)
committerTimo Sirainen <tss@iki.fi>
Mon, 12 Jan 2009 17:05:19 +0000 (12:05 -0500)
--HG--
branch : HEAD

src/lib-sql/driver-pgsql.c

index d0c08254531f3609ab92c9646c8d5feb50548c4d..e31b7979b21db10080fad1f8480ce20d55456740 100644 (file)
@@ -85,13 +85,17 @@ static void result_finish(struct pgsql_result *result);
 
 static void driver_pgsql_close(struct pgsql_db *db)
 {
-       if (db->io != NULL)
-               io_remove(&db->io);
        db->io_dir = 0;
 
        PQfinish(db->pg);
        db->pg = NULL;
 
+       if (db->io != NULL) {
+               /* The fd may be closed before call to PQfinish() already,
+                  so use io_remove_closed(). */
+               io_remove_closed(&db->io);
+       }
+
        db->connecting = FALSE;
        db->connected = FALSE;
         db->querying = FALSE;