dovecot-1.2: psql: Don't give errors with epoll if db connection...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jan 12 20:26:39 EET 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/fc3bd6608c90
changeset: 8614:fc3bd6608c90
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jan 12 12:05:19 2009 -0500
description:
psql: Don't give errors with epoll if db connection gets closed.

diffstat:

1 file changed, 6 insertions(+), 2 deletions(-)
src/lib-sql/driver-pgsql.c |    8 ++++++--

diffs (22 lines):

diff -r 37e74d43ff26 -r fc3bd6608c90 src/lib-sql/driver-pgsql.c
--- a/src/lib-sql/driver-pgsql.c	Mon Jan 12 10:44:13 2009 -0500
+++ b/src/lib-sql/driver-pgsql.c	Mon Jan 12 12:05:19 2009 -0500
@@ -85,12 +85,16 @@ static void result_finish(struct pgsql_r
 
 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;


More information about the dovecot-cvs mailing list