X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=service%2Ftrigger.c;h=fb249b6605dccc7100566ed2a0d6bdf18d2ac8cc;hp=97a06bb57d1a4bcf4769c4c81831d35b4456a3be;hb=e08f52e4f5fb1f20c09e7c69a616b76dc4710d6b;hpb=45cb04fd85d788a37367a5385e5e90dd98a0a991 diff --git a/service/trigger.c b/service/trigger.c index 97a06bb..fb249b6 100644 --- a/service/trigger.c +++ b/service/trigger.c @@ -77,6 +77,9 @@ rule_load_script(struct json_script_ctx *ctx, const char *name) { struct trigger *t = container_of(ctx, struct trigger, jctx); + if (strcmp(name, t->type) != 0) + return NULL; + return json_script_file_from_blobmsg(t->type, t->rule, blob_pad_len(t->rule)); } @@ -225,7 +228,7 @@ static void trigger_delay_cb(struct uloop_timeout *tout) { struct trigger *t = container_of(tout, struct trigger, delay); - json_script_run(&t->jctx, "foo", t->data); + json_script_run(&t->jctx, t->type, t->data); free(t->data); t->data = NULL; } @@ -344,7 +347,7 @@ void trigger_event(const char *type, struct blob_attr *data) t->data = blob_memdup(data); uloop_timeout_set(&t->delay, t->timeout); } else { - json_script_run(&t->jctx, "foo", data); + json_script_run(&t->jctx, t->type, data); } } }