Fix crash when connection to postgres fails, backported from upstream

git commit c3d5d52ad084a98cc161.
From Piotr Sikora, thanks!
This commit is contained in:
landry 2011-04-03 09:04:54 +00:00
parent 2fbe435e12
commit 63fd810c25
2 changed files with 16 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.7 2011/03/20 09:19:25 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.8 2011/04/03 09:04:54 landry Exp $
COMMENT = mail server storing messages in a database
DISTNAME = archiveopteryx-3.1.3
REVISION = 3
REVISION = 4
CATEGORIES = mail databases
HOMEPAGE = http://www.archiveopteryx.org/

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-db_database_cpp,v 1.1 2011/04/03 09:04:54 landry Exp $
Backport c3d5d52ad084a98cc161
Fix crash when connection to postgres fails.
--- db/database.cpp.orig
+++ db/database.cpp
@@ -339,6 +339,8 @@ void Database::removeHandle( Database * d )
return;
handles->remove( d );
+ if ( !totalDbConnections )
+ totalDbConnections = new GraphableNumber( "total-db-connections" );
totalDbConnections->setValue( handles->count() );
if ( !handles->isEmpty() )
return;