router: fix tag regression check
@@ -106,7 +106,23 @@ static inline int router_match(const char *tag, int tag_len,
int flb_router_match(const char *tag, int tag_len, const char *match,
void *match_regex)
{
- return router_match(tag, tag_len, match, match_regex);
+ int ret;
+ flb_sds_t t;
+
+ if (tag[tag_len] != '\0') {
+ t = flb_sds_create_len(tag, tag_len);
+ if (!t) {
+ return FLB_FALSE;
+ }
+
+ ret = router_match(t, tag_len, match, match_regex);
+ flb_sds_destroy(t);
+ }
+ else {
+ ret = router_match(tag, tag_len, match, match_regex);
+ }
+
+ return ret;
}
/* Associate and input and output instances due to a previous match */
@@ -117,7 +133,7 @@ static int flb_router_connect(struct flb_input_instance *in,
p = flb_malloc(sizeof(struct flb_router_path));
if (!p) {
- perror("malloc");
+ flb_errno();
return -1;
}
