TraceLoggingEventEnabled - fix for events with keywords (#21)

Bug in TraceLoggingEventEnabled that only occurs if the event has a
keyword.

`TraceLoggingEventEnabled(ProviderSymbol, "EventName")` needs to look up
the requested event. Events are identified by a
"ProviderName:EventName;KeywordSuffix" string.

TraceLoggingEventEnabled is supposed to work by creating a
"ProviderName:EventName" string, doing a prefix match on the event, and
if the prefix match succeeds, we check that the next character is a ';'
(meaning we matched up to the keyword prefix) or a 0 (meaning we matched
the full event string).

Due to a bug, instead it creates a "ProviderName:EventName;k;" string.
This successfully matches as long as the event has no keywords, but it
incorrectly fails to match if the event does have any keywords.

Fix is to cut off the last three characters after creating the
"ProviderName:EventName;k;" string.
This commit is contained in:
Doug Cook 2021-04-24 18:32:22 -04:00 коммит произвёл GitHub
Родитель ccde8556db
Коммит 39921c9feb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -1516,7 +1516,7 @@ Examples:
pchEventFullName,
pProvider->ProbeDesc.provider, (unsigned)strlen(pProvider->ProbeDesc.provider),
eventName, (unsigned)strlen(eventName),
0); // Don't add keyword suffix.
0) - 3; // Don't add keyword suffix.
for (struct lttng_event_desc const **ppDesc = pEventDescStart; ppDesc != pEventDescStop; ppDesc += 1)
{