--- libaitcfg/src/queue.c 2026/10/05 16:44:48 1.22 +++ libaitcfg/src/queue.c 2026/10/07 22:07:30 1.22.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: queue.c,v 1.22 2026/10/05 16:44:48 misho Exp $ +* $Id: queue.c,v 1.22.2.1 2026/10/07 22:07:30 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -83,24 +83,27 @@ _selectAttribute(cfg_root_t * __restrict cfg, const ch c = RB_FIND(tagRC, cfg, &fav); if (!c) return NULL; /* not found */ - if ((!csSec && AIT_ISEMPTY(&c->cfg_sec)) || (csSec && !AIT_ISEMPTY(&c->cfg_sec) && - !strcmp(csSec, AIT_GET_STR(&c->cfg_sec)))) + if ((!csSec && AIT_ISEMPTY(&c->cfg_sec)) || (csSec && !*csSec && AIT_ISEMPTY(&c->cfg_sec)) || + (csSec && !AIT_ISEMPTY(&c->cfg_sec) && !strcmp(csSec, AIT_GET_STR(&c->cfg_sec)))) { if (!AIT_ISEMPTY(&c->cfg_attr) && !strcmp(csAttr, AIT_GET_STR(&c->cfg_attr))) { if (find) *find = 1; return c; /* FOUND! */ } + } /* if cannot find right attribute */ TAILQ_FOREACH_SAFE(c, cfg, cfg_next, n) { - if ((!csSec && AIT_ISEMPTY(&c->cfg_sec)) || - (csSec && !AIT_ISEMPTY(&c->cfg_sec) && - !strcmp(csSec, AIT_GET_STR(&c->cfg_sec)))) + if ((!csSec && AIT_ISEMPTY(&c->cfg_sec)) || + (csSec && !*csSec && AIT_ISEMPTY(&c->cfg_sec)) || + (csSec && !AIT_ISEMPTY(&c->cfg_sec) && + !strcmp(csSec, AIT_GET_STR(&c->cfg_sec)))) { if (!AIT_ISEMPTY(&c->cfg_attr) && csAttr && !strcmp(csAttr, AIT_GET_STR(&c->cfg_attr))) { if (find) *find = 2; return c; /* FOUND! */ } + } } return NULL; /* not found */ }