diff --git a/src/sf_global.c b/src/sf_global.c index 5f09c1a..a3d4bb1 100644 --- a/src/sf_global.c +++ b/src/sf_global.c @@ -219,17 +219,10 @@ int sf_load_slow_log_config_ex(IniFullContext *ini_ctx, LogContext *log_ctx, return 0; } -int sf_load_global_config_ex(const char *server_name, - IniFullContext *ini_ctx, const bool load_network_params, - const int task_buffer_extra_size) +int sf_load_global_base_path(IniFullContext *ini_ctx) { - int result; - const char *old_section_name; char *pBasePath; - char *pRunByGroup; - char *pRunByUser; - g_sf_global_vars.task_buffer_extra_size = task_buffer_extra_size; if (!g_sf_global_vars.base_path.inited) { pBasePath = iniGetStrValue(NULL, "base_path", ini_ctx->context); if (pBasePath == NULL) { @@ -255,6 +248,23 @@ int sf_load_global_config_ex(const char *server_name, return ENOTDIR; } + return 0; +} + +int sf_load_global_config_ex(const char *server_name, + IniFullContext *ini_ctx, const bool load_network_params, + const int task_buffer_extra_size) +{ + int result; + const char *old_section_name; + char *pRunByGroup; + char *pRunByUser; + + if ((result=sf_load_global_base_path(ini_ctx)) != 0) { + return result; + } + + g_sf_global_vars.task_buffer_extra_size = task_buffer_extra_size; g_sf_global_vars.tcp_quick_ack = iniGetBoolValue(NULL, "tcp_quick_ack", ini_ctx->context, true); tcp_set_quick_ack(g_sf_global_vars.tcp_quick_ack); diff --git a/src/sf_global.h b/src/sf_global.h index 4778648..07cb1fd 100644 --- a/src/sf_global.h +++ b/src/sf_global.h @@ -205,6 +205,8 @@ void sf_log_config_ex(const char *other_config); #define sf_log_config_to_string(log_cfg, caption, output, size) \ sf_log_config_to_string_ex(log_cfg, caption, NULL, output, size) +int sf_load_global_base_path(IniFullContext *ini_ctx); + static inline void sf_set_global_base_path(const char *base_path) { snprintf(SF_G_BASE_PATH_STR, sizeof(SF_G_BASE_PATH_STR),