From 1cd509518956cd0ad3cfa4c279643a098bc0be2c Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 7 Aug 2007 11:04:14 +0000 Subject: moved code to create/delete message queue to init(), after reading the conf file. This is a prequisite to allow specifying the queue size in the conf file. --- syslogd.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'syslogd.c') diff --git a/syslogd.c b/syslogd.c index 2bd3206f..1b0599de 100644 --- a/syslogd.c +++ b/syslogd.c @@ -4188,6 +4188,15 @@ static void init(void) dprintf("Clearing templates.\n"); tplDeleteNew(); + +#ifdef USE_PTHREADS + if(pMsgQueue != NULL) { + dprintf("deleting message queue\n"); + queueDelete(pMsgQueue); /* delete fifo here! */ + pMsgQueue = NULL; + } +#endif + /* re-setting values to defaults (where applicable) */ /* TODO: once we have loadable modules, we must re-visit this code. The reason is @@ -4278,7 +4287,14 @@ static void init(void) #endif # ifdef USE_PTHREADS - startWorker(); + /* create message queue */ + pMsgQueue = queueInit(); + if(pMsgQueue == NULL) { + errno = 0; + logerror("error: could not create message queue - running single-threaded!\n"); + } + + startWorker(); # endif Initialized = 1; @@ -5806,15 +5822,6 @@ int main(int argc, char **argv) exit(1); /* "good" exit, leaving at init for fatal error */ } -#ifdef USE_PTHREADS - /* create message queue */ - pMsgQueue = queueInit(); - if(pMsgQueue == NULL) { - errno = 0; - logerror("error: could not create message queue - running single-threaded!\n"); - } -#endif - if((iRet = loadBuildInModules()) != RS_RET_OK) { fprintf(stderr, "fatal error: could not activate built-in modules. Error code %d.\n", iRet); -- cgit