--- libaitcfg/src/aitcfg.c 2025/08/19 10:42:28 1.16.6.1 +++ libaitcfg/src/aitcfg.c 2025/08/19 11:06:32 1.16.6.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitcfg.c,v 1.16.6.1 2025/08/19 10:42:28 misho Exp $ +* $Id: aitcfg.c,v 1.16.6.2 2025/08/19 11:06:32 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -165,7 +165,10 @@ cfgEndConfig(cfg_root_t **pcfg) cfg_root_t * cfgInitConfigExt(cfg_root_t * __restrict cfg) { - if (!TAILQ_EMPTY(cfg) || !RB_EMPTY(cfg)) + pthread_mutex_t mtx = { 0 }; + + if (!TAILQ_EMPTY(cfg) || !RB_EMPTY(cfg) || + memcmp(&cfg->rc_mtx, &mtx, sizeof mtx)) cfgUnloadConfig(cfg); memset(cfg, 0, sizeof(cfg_root_t)); @@ -189,12 +192,14 @@ cfgLoadConfig(const char *cfgName, cfg_root_t * __rest { FILE *f; int ret; + pthread_mutex_t mtx = { 0 }; if (!cfgName || !cfg) { cfg_SetErr(EINVAL, "Invalid parameter(s)"); return -1; } else { - if (!TAILQ_EMPTY(cfg) || !RB_EMPTY(cfg)) + if (!TAILQ_EMPTY(cfg) || !RB_EMPTY(cfg) || + memcmp(&cfg->rc_mtx, &mtx, sizeof mtx)) cfgUnloadConfig(cfg); memset(cfg, 0, sizeof(cfg_root_t));