Skip to content

Commit 65a2793

Browse files
committed
ml: Avoid to use the collided status code
1 is also indicated for FLB_TRUE. Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent a72b13f commit 65a2793

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

include/fluent-bit/multiline/flb_ml.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
/* Return codes */
5959
#define FLB_MULTILINE_OK 0
60-
#define FLB_MULTILINE_TRUNCATED 1
60+
#define FLB_MULTILINE_TRUNCATED 2
6161

6262
/* Maximum number of groups per stream */
6363
#define FLB_ML_MAX_GROUPS 6

src/multiline/flb_ml.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ static int package_content(struct flb_ml_stream *mst,
213213
{
214214
int len;
215215
int ret;
216+
int truncated = FLB_FALSE;
216217
int rule_match = FLB_FALSE;
217218
int processed = FLB_FALSE;
218219
int type;
@@ -259,11 +260,13 @@ static int package_content(struct flb_ml_stream *mst,
259260
stream_group, full_map, buf, size, tm,
260261
val_content, val_pattern);
261262
if (ret == -1) {
262-
processed = FLB_FALSE;
263+
return -1;
263264
}
264-
else {
265-
processed = FLB_TRUE;
265+
266+
if (ret == FLB_MULTILINE_TRUNCATED) {
267+
truncated = FLB_TRUE;
266268
}
269+
processed = FLB_TRUE;
267270
}
268271
else if (type == FLB_ML_ENDSWITH) {
269272
len = flb_sds_len(parser->match_str);
@@ -340,6 +343,10 @@ static int package_content(struct flb_ml_stream *mst,
340343
msgpack_pack_object(&stream_group->mp_md_pck, *metadata);
341344
}
342345

346+
if (truncated) {
347+
return FLB_MULTILINE_TRUNCATED;
348+
}
349+
343350
return processed;
344351
}
345352

0 commit comments

Comments
 (0)