From 6563ad715bf8371fa6f551d6128d8b0d5e903f15 Mon Sep 17 00:00:00 2001 From: "Constantin P." <papizh.konstantin@demlabs.net> Date: Mon, 9 Sep 2024 05:39:35 +0000 Subject: [PATCH] Hotfix 12930 --- CMakeLists.txt | 6 +++++- cellframe-sdk | 2 +- dap-sdk | 2 +- diagtool | 2 +- sources/main.c | 14 ++++++++------ sources/main_node_tool.c | 11 +++++++---- sources/node_manager.c | 11 +++++++---- 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19d76a29b..97ff2ecf9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -238,7 +238,11 @@ if(WIN32) set_property(TARGET ${NODE_TOOL_TARGET} APPEND_STRING PROPERTY LINK_FLAGS "-mconsole") target_link_libraries(${PROJECT_NAME} cellframe-sdk dap_json-c ) - set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS "-mconsole") + if ((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (DAP_DEBUG)) + set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS "-mconsole") + else() + set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS "-mwindows") + endif() endif() if(BSD) diff --git a/cellframe-sdk b/cellframe-sdk index 54c2ecbf3..163c99833 160000 --- a/cellframe-sdk +++ b/cellframe-sdk @@ -1 +1 @@ -Subproject commit 54c2ecbf33ccadec7e23b6e5d86087076fb48687 +Subproject commit 163c99833c539a6c990f23ab217b02e13ff79b21 diff --git a/dap-sdk b/dap-sdk index 13684a1f7..9e7565c94 160000 --- a/dap-sdk +++ b/dap-sdk @@ -1 +1 @@ -Subproject commit 13684a1f796bc8ee2cc15f925782113a1040855c +Subproject commit 9e7565c9417bad979e90b83ccd537aecfe7c07f9 diff --git a/diagtool b/diagtool index c1717af68..f2a88e9bc 160000 --- a/diagtool +++ b/diagtool @@ -1 +1 @@ -Subproject commit c1717af680c11e8c893fdb24b282673403510be1 +Subproject commit f2a88e9bc98e5b73cfb04a936ec68c2f50344d55 diff --git a/sources/main.c b/sources/main.c index b6b530cdf..ec8b62fd0 100755 --- a/sources/main.c +++ b/sources/main.c @@ -169,19 +169,21 @@ int main( int argc, const char **argv ) #endif } - log_it(L_DEBUG, "Use main path: %s", g_sys_dir_path); - { char *l_log_dir = dap_strdup_printf("%s/var/log", g_sys_dir_path); dap_mkdir_with_parents(l_log_dir); char * l_log_file = dap_strdup_printf( "%s/%s.log", l_log_dir, dap_get_appname()); - if (dap_common_init(dap_get_appname(), l_log_file, l_log_dir) != 0) { - printf("Fatal Error: Can't init common functions module"); - return -2; - } + if (dap_common_init(dap_get_appname(), l_log_file, l_log_dir) != 0) + return printf("Fatal Error: Can't init common functions module"), -2; +#if defined (DAP_DEBUG) || !defined(DAP_OS_WINDOWS) + dap_log_set_external_output(LOGGER_OUTPUT_STDOUT, NULL); +#else + dap_log_set_external_output(LOGGER_OUTPUT_NONE, NULL); +#endif DAP_DELETE(l_log_dir); DAP_DELETE(l_log_file); } + log_it(L_DEBUG, "Use main path: %s", g_sys_dir_path); { char l_config_dir[MAX_PATH] = {'\0'}; diff --git a/sources/main_node_tool.c b/sources/main_node_tool.c index dc85008c1..b65c9f785 100644 --- a/sources/main_node_tool.c +++ b/sources/main_node_tool.c @@ -633,10 +633,13 @@ static int s_cert_get_addr(int argc, const char **argv) { */ static int s_init() { - if (dap_common_init(dap_get_appname(), NULL, NULL) != 0) { - printf("Fatal Error: Can't init common functions module"); - return -2; - } + if (dap_common_init(dap_get_appname(), NULL, NULL) != 0) + return printf("Fatal Error: Can't init common functions module"), -2; +#if defined (DAP_DEBUG) || !defined(DAP_OS_WINDOWS) + dap_log_set_external_output(LOGGER_OUTPUT_STDOUT, NULL); +#else + dap_log_set_external_output(LOGGER_OUTPUT_NONE, NULL); +#endif dap_log_level_set(L_ERROR); char l_config_dir[MAX_PATH] = {'\0'}; sprintf(l_config_dir, "%s/etc", g_sys_dir_path); diff --git a/sources/node_manager.c b/sources/node_manager.c index dd8eb7c33..829371a15 100644 --- a/sources/node_manager.c +++ b/sources/node_manager.c @@ -89,10 +89,13 @@ void client_disconnect(dap_server_client_t *client,void * arg) * @return Zero if ok or error code */ int node_manager_init(){ - if(dap_common_init("build/log.txt")!=0){ - log_it(L_CRITICAL,"Can't init common functions module"); - return -2; - } + if ( dap_common_init("build/log.txt") ) + return printf("Can't init common functions module"), -2; +#if defined (DAP_DEBUG) || !defined(DAP_OS_WINDOWS) + dap_log_set_external_output(LOGGER_OUTPUT_STDOUT, NULL); +#else + dap_log_set_external_output(LOGGER_OUTPUT_NONE, NULL); +#endif if(dap_config_init("build/config")!=0){ log_it(L_CRITICAL,"Can't init configurations module"); return -1; -- GitLab