From aadaf1c071c41198c08f5214708d4ee8ecd07f47 Mon Sep 17 00:00:00 2001 From: Leonardo Alminana Date: Mon, 21 Oct 2024 21:21:17 +0200 Subject: [PATCH] in_blob: fixed already registered file log message Signed-off-by: Leonardo Alminana --- plugins/in_blob/blob.c | 5 +++++ plugins/in_blob/blob_file.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/in_blob/blob.c b/plugins/in_blob/blob.c index 8081a9a42fe..c3fb8918e62 100644 --- a/plugins/in_blob/blob.c +++ b/plugins/in_blob/blob.c @@ -561,6 +561,11 @@ static ssize_t recursive_file_search(struct blob_ctx *ctx, (uint64_t) fs_entry_metadata.st_ino); } else { + /* Result codes : + * 0 - Success + * -1 - Generic failure + * 1 - The file was alrady present in our records + */ flb_plg_debug(ctx->ins, "blob scan skip: %s", glob_context.gl_pathv[index]); diff --git a/plugins/in_blob/blob_file.c b/plugins/in_blob/blob_file.c index bf5aaf5caca..0a51bd9de81 100644 --- a/plugins/in_blob/blob_file.c +++ b/plugins/in_blob/blob_file.c @@ -40,7 +40,7 @@ int blob_file_append(struct blob_ctx *ctx, char *path, struct stat *st) bfile = cfl_list_entry(head, struct blob_file, _head); if (strcmp(bfile->path, path) == 0) { /* file already exists */ - return -1; + return 1; } } @@ -48,7 +48,7 @@ int blob_file_append(struct blob_ctx *ctx, char *path, struct stat *st) if (ctx->database_file) { /* the file was already registered, just skipt it */ if (blob_db_file_exists(ctx, path, &id_found) == FLB_TRUE) { - return 0; + return 1; } } #endif