summaryrefslogtreecommitdiffstats
path: root/service
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-06-02 16:27:56 +0200
committerFelix Fietkau <nbd@openwrt.org>2015-06-04 22:05:00 +0200
commit47462caa6346dd4c51ae4ba6061f124e94ecce7a (patch)
treec3de2ef5aed69f7b2233c780dfecd04dc3e400d4 /service
parent94e7ea8b88cb01192a6fb1f1f6a68ada1356763f (diff)
downloadunitd-47462caa6346dd4c51ae4ba6061f124e94ecce7a.tar
unitd-47462caa6346dd4c51ae4ba6061f124e94ecce7a.zip
trigger: make trigger_match() bool and make return value less confusing
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'service')
-rw-r--r--service/trigger.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/service/trigger.c b/service/trigger.c
index a8533b3..97a06bb 100644
--- a/service/trigger.c
+++ b/service/trigger.c
@@ -323,12 +323,12 @@ void trigger_init(void)
q.max_running_tasks = 1;
}
-static int trigger_match(const char *event, const char *match)
+static bool trigger_match(const char *event, const char *match)
{
char *wildcard = strstr(match, ".*");
if (wildcard)
- return strncmp(event, match, wildcard - match);
- return strcmp(event, match);
+ return !strncmp(event, match, wildcard - match);
+ return !strcmp(event, match);
}
void trigger_event(const char *type, struct blob_attr *data)
@@ -338,7 +338,7 @@ void trigger_event(const char *type, struct blob_attr *data)
list_for_each_entry(t, &triggers, list) {
if (t->remove)
continue;
- if (!trigger_match(type, t->type)) {
+ if (trigger_match(type, t->type)) {
if (t->timeout) {
free(t->data);
t->data = blob_memdup(data);