Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_tail: Work around "undeletable file" issue on Windows #2141

Merged
merged 1 commit into from
May 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions plugins/in_tail/tail_fs_stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,26 @@ static int tail_fs_check(struct flb_input_instance *ins,
continue;
}

#ifdef FLB_SYSTEM_WINDOWS
HANDLE h;
FILE_STANDARD_INFO info;

h = _get_osfhandle(file->fd);
fujimotos marked this conversation as resolved.
Show resolved Hide resolved
if (GetFileInformationByHandleEx(h, FileStandardInfo,
&info, sizeof(info))) {
if (info.DeletePending) {
flb_plg_debug(ctx->ins, "file is to be delete: %s", file->name);
#ifdef FLB_HAVE_SQLDB
if (ctx->db) {
flb_tail_db_file_delete(file, ctx);
}
#endif
flb_tail_file_remove(file);
continue;
}
}
#endif

/* Discover the current file name for the open file descriptor */
name = flb_tail_file_name(file);
if (!name) {
Expand Down