]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pgsql: Don't assert-crash if query fails when trying to send it.
authorTimo Sirainen <tss@iki.fi>
Fri, 4 Mar 2011 17:51:06 +0000 (19:51 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 4 Mar 2011 17:51:06 +0000 (19:51 +0200)
src/lib-sql/driver-pgsql.c

index f5e04931a58d0c39ae8c73a36ea37519e9a16b4f..205a0e38357fe0b947372af153532f56f4ac8154 100644 (file)
@@ -450,6 +450,7 @@ static void do_query(struct pgsql_result *result, const char *query)
        i_assert(db->cur_result == NULL);
        i_assert(db->io == NULL);
 
+       driver_pgsql_set_state(db, SQL_DB_STATE_BUSY);
        db->cur_result = result;
        result->to = timeout_add(SQL_QUERY_TIMEOUT_SECS * 1000,
                                 query_timeout, result);
@@ -461,7 +462,6 @@ static void do_query(struct pgsql_result *result, const char *query)
                return;
        }
 
-       driver_pgsql_set_state(db, SQL_DB_STATE_BUSY);
        if (ret > 0) {
                /* write blocks */
                db->io = io_add(PQsocket(db->pg), IO_WRITE,