[syslog-ng] [PATCH] Fix: maximum thread number can be 0

Juhasz Viktor jviktor at balabit.hu
Mon Jun 27 09:53:31 CEST 2011


   [threading] It is possible that the _SC_NPROCESSORS_ONLN isn't defined.

    In this case the max threads must greater than 0

    Signed-off-by: Viktor Juhasz <jviktor at balabit.hu>

diff --git a/lib/mainloop.c b/lib/mainloop.c
index e659fff..b23d055 100644
--- a/lib/mainloop.c
+++ b/lib/mainloop.c
@@ -702,6 +702,8 @@ main_loop_add_options(GOptionContext *ctx)
 {
 #ifdef _SC_NPROCESSORS_ONLN
   main_loop_io_workers.max_threads = MIN(MAX(2, 
sysconf(_SC_NPROCESSORS_ONLN)), 64);
+#else
+  main_loop_io_workers.max_threads = 2;
 #endif

   g_option_context_add_main_entries(ctx, main_loop_options, NULL);



More information about the syslog-ng mailing list