diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-03-19 12:25:14 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-03-19 12:25:14 +0300 |
commit | 6088008d6c307a553b896eacee60a7ae69fda9dd (patch) | |
tree | 16787da296c228c607723df4f798b50b69636379 /src/main.c | |
parent | 9c455404d443c748b6398076c1746a12a7458bfc (diff) | |
download | rspamd-6088008d6c307a553b896eacee60a7ae69fda9dd.tar.gz rspamd-6088008d6c307a553b896eacee60a7ae69fda9dd.zip |
* With flag -t syntax of modules variables is also inspected
* Set "C" locale on start to avoid some troubles with logging
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/main.c b/src/main.c index 16af301dc..56bad7e67 100644 --- a/src/main.c +++ b/src/main.c @@ -383,7 +383,15 @@ main (int argc, char **argv, char **env) else { cfg->log_level = G_LOG_LEVEL_CRITICAL; } - + +#ifdef HAVE_SETLOCALE + /* Set locale setting to C locale to avoid problems in future */ + setlocale (LC_ALL, "C"); + setlocale (LC_CTYPE, "C"); + setlocale (LC_MESSAGES, "C"); + setlocale (LC_TIME, "C"); +#endif + /* First set logger to console logger */ cfg->log_fd = STDERR_FILENO; g_log_set_default_handler (file_log_function, cfg); @@ -406,9 +414,26 @@ main (int argc, char **argv, char **env) fclose (f); + /* Init C modules */ + for (i = 0; i < MODULES_NUM; i ++) { + cur_module = memory_pool_alloc (rspamd->cfg->cfg_pool, sizeof (struct module_ctx)); + if (modules[i].module_init_func(cfg, &cur_module) == 0) { + g_hash_table_insert (cfg->c_modules, (gpointer)modules[i].name, cur_module); + } + } + if (cfg->config_test) { - fprintf (stderr, "syntax OK\n"); - return EXIT_SUCCESS; + /* Init events to test modules */ + event_init (); + res = TRUE; + /* Perform modules configuring */ + for (i = 0; i < MODULES_NUM; i ++) { + if (!modules[i].module_config_func (cfg)) { + res = FALSE; + } + } + fprintf (stderr, "syntax %s\n", res ? "OK" : "BAD"); + return res ? EXIT_SUCCESS : EXIT_FAILURE; } /* Create listen socket */ @@ -450,14 +475,6 @@ main (int argc, char **argv, char **env) exit (-errno); } - /* Init C modules */ - for (i = 0; i < MODULES_NUM; i ++) { - cur_module = memory_pool_alloc (rspamd->cfg->cfg_pool, sizeof (struct module_ctx)); - if (modules[i].module_init_func(cfg, &cur_module) == 0) { - g_hash_table_insert (cfg->c_modules, (gpointer)modules[i].name, cur_module); - } - } - rspamd->pid = getpid(); rspamd->type = TYPE_MAIN; |