while ((evt_ent = readdir(evt_dir))) {
char event_opt[MAX_EVOPT_LEN + 1];
int len;
- unsigned int rem = MAX_EVOPT_LEN;
if (!strcmp(evt_ent->d_name, ".")
|| !strcmp(evt_ent->d_name, "..")
|| !strcmp(evt_ent->d_name, "filter"))
continue;
- len = snprintf(event_opt, MAX_EVOPT_LEN, "%s:%s", sys_name,
- evt_ent->d_name);
+ len = snprintf(event_opt, MAX_EVOPT_LEN, "%s:%s%s%s", sys_name,
+ evt_ent->d_name, flags ? ":" : "",
+ flags ?: "");
if (len < 0)
return EVT_FAILED;
- rem -= len;
- if (flags) {
- if (rem < strlen(flags) + 1)
- return EVT_FAILED;
-
- strcat(event_opt, ":");
- strcat(event_opt, flags);
- }
-
if (parse_events(NULL, event_opt, 0))
return EVT_FAILED;
}