oc: Protect backend initialization to happen only once

This commit is contained in:
Kamen Mazdrashki
2014-06-19 20:41:37 +02:00
committed by Julio García
parent 5b75c817e2
commit 1fc3a57210
+7
View File
@@ -140,8 +140,14 @@ sogo_backend_init (void)
Class MAPIApplicationK;
NSUserDefaults *ud;
SoProductRegistry *registry;
static BOOL moduleInitialized = NO;
char *argv[] = { SAMBA_PREFIX "/sbin/samba", NULL };
if (moduleInitialized) {
DEBUG(0, ("SOGo backend already initialized.\n"));
return MAPISTORE_SUCCESS;
}
GSRegisterCurrentThread ();
pool = [NSAutoreleasePool new];
@@ -185,6 +191,7 @@ sogo_backend_init (void)
[pool release];
DEBUG(0, ("[SOGo: %s:%d] backend init SUCCESS. Current thread: %p, pid: %d\n", __FUNCTION__, __LINE__, GSCurrentThread(), getpid()));
moduleInitialized = YES;
return MAPISTORE_SUCCESS;
}