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

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


details:   http://hg.dovecot.org/dovecot-1.1/rev/da553dd1f470
changeset: 8085:da553dd1f470
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 edf2a285fa28 -r da553dd1f470 src/lib-sql/driver-pgsql.c
--- a/src/lib-sql/driver-pgsql.c	Mon Jan 12 10:43:37 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