Skip to content

Commit

Permalink
in_tail: close inotify fd on exit
Browse files Browse the repository at this point in the history
This patch fixes a problem where the fd returned by inotify_init1(2) was
not closed.

Tested with the unit test and valgrind.

Signed-off-by: Emma Haruka Iwao <yuryu@google.com>
  • Loading branch information
yuryu authored and nokute78 committed Oct 30, 2021
1 parent 231ef4b commit 516fb40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions plugins/in_tail/tail.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ static int in_tail_exit(void *data, struct flb_config *config)
struct flb_tail_config *ctx = data;

flb_tail_file_remove_all(ctx);
flb_tail_fs_exit(ctx);
flb_tail_config_destroy(ctx);

return 0;
Expand Down
3 changes: 1 addition & 2 deletions plugins/in_tail/tail_fs_inotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,5 @@ int flb_tail_fs_inotify_remove(struct flb_tail_file *file)

int flb_tail_fs_inotify_exit(struct flb_tail_config *ctx)
{
(void) ctx;
return 0;
return close(ctx->fd_notify);
}

0 comments on commit 516fb40

Please sign in to comment.