Fix return value of hook calls that have no handlers.

For this case, the return value is always true.
This commit is contained in:
Jon Siwek 2012-12-18 15:31:50 -06:00
parent 4a09c12882
commit 98663fd534
2 changed files with 2 additions and 1 deletions

View file

@ -288,7 +288,7 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
assert(Flavor() == FUNC_FLAVOR_EVENT || Flavor() == FUNC_FLAVOR_HOOK); assert(Flavor() == FUNC_FLAVOR_EVENT || Flavor() == FUNC_FLAVOR_HOOK);
loop_over_list(*args, i) loop_over_list(*args, i)
Unref((*args)[i]); Unref((*args)[i]);
return 0 ; return Flavor() == FUNC_FLAVOR_HOOK ? new Val(true, TYPE_BOOL) : 0;
} }
SegmentProfiler(segment_logger, location); SegmentProfiler(segment_logger, location);

View file

@ -3,6 +3,7 @@ myhook return F
myhook return T myhook return T
myhook, &priority=5, [a=37, b=goobye world] myhook, &priority=5, [a=37, b=goobye world]
F F
T
myhook3, 8 myhook3, 8
T T
myhook4, 2 myhook4, 2