From c0fd6e1982353d056c26a292186ef0df315adde3 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 20 Mar 2017 09:08:12 +0000 Subject: Fix: Avoid segfault if diagnostic bus isn't correctly set. There is a segfault when binding configuration doesn't matches configuration generated. Improve general CAN bus device initialization. Change-Id: I17ea94ee54841d09ac63a7ffad303a88d99e0173 Signed-off-by: Romain Forlot --- src/low-can-binding.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/low-can-binding.cpp') diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp index 3e870721..45213d91 100644 --- a/src/low-can-binding.cpp +++ b/src/low-can-binding.cpp @@ -255,13 +255,15 @@ extern "C" /// Initialize CAN socket if(can_bus_manager.init_can_dev() == 0) + { can_bus_manager.start_threads(); - /// Initialize Diagnostic manager that will handle obd2 requests. - /// We pass by default the first CAN bus device to its Initialization. - /// TODO: be able to choose the CAN bus device that will be use as Diagnostic bus. - if(configuration_t::instance().get_diagnostic_manager().initialize()) - return 0; + /// Initialize Diagnostic manager that will handle obd2 requests. + /// We pass by default the first CAN bus device to its Initialization. + /// TODO: be able to choose the CAN bus device that will be use as Diagnostic bus. + if(configuration_t::instance().get_diagnostic_manager().initialize()) + return 0; + } ERROR(binder_interface, "There was something wrong with CAN device Initialization. Check your config file maybe"); return 1; -- cgit 1.2.3-korg