bbf: don't remove the dot at the end of the value if there is already a dot at the end

This commit is contained in:
Amin Ben Ramdhane 2021-11-25 18:06:26 +01:00
parent c3502d1085
commit c9789e90d6

View file

@ -295,10 +295,14 @@ static void resolve_all_symbols(struct dmctx *ctx, void *data, char *instance, c
{
char *pch = NULL, *pchr = NULL;
char buf_key[256] = {0};
bool has_dot = false;
unsigned pos = 0;
DM_STRNCPY(buf_key, old_key, sizeof(buf_key));
if (buf_key[strlen(buf_key) - 1] == '.')
has_dot = true;
for (pch = strtok_r(buf_key, ".", &pchr); pch != NULL; pch = strtok_r(NULL, ".", &pchr)) {
if (strcmp(pch, "@Name") == 0)
@ -317,7 +321,7 @@ static void resolve_all_symbols(struct dmctx *ctx, void *data, char *instance, c
pos += snprintf(&new_key[pos], key_len - pos, "%s.", pch);
}
if (pos)
if (pos && !has_dot)
new_key[pos - 1] = 0;
if (strstr(new_key, "{i}"))