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

bugfix: fwatcher: fix recursion detect issue for linux platform #266

Merged
merged 2 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/tbox/platform/bsd/fwatcher_kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ tb_bool_t tb_fwatcher_add(tb_fwatcher_ref_t self, tb_char_t const* watchdir, tb_
return tb_false;

// is directory? we need scan it and add all subfiles
if (info.type == TB_FILE_TYPE_DIRECTORY)
tb_directory_walk(watchdir, recursion? -1 : 0, tb_true, tb_fwatcher_add_watch_filedirs, fwatcher);
if (info.type == TB_FILE_TYPE_DIRECTORY && recursion)
tb_directory_walk(watchdir, -1, tb_true, tb_fwatcher_add_watch_filedirs, fwatcher);
return tb_fwatcher_add_watch(fwatcher, watchdir, recursion);
}

Expand Down
2 changes: 1 addition & 1 deletion src/tbox/platform/linux/fwatcher_inotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ tb_bool_t tb_fwatcher_add(tb_fwatcher_ref_t self, tb_char_t const* watchdir, tb_

// is directory? we need scan it and add all subdirs
if (info.type == TB_FILE_TYPE_DIRECTORY && recursion)
tb_directory_walk(watchdir, 0, tb_true, tb_fwatcher_add_watch_dirs, fwatcher);
tb_directory_walk(watchdir, -1, tb_true, tb_fwatcher_add_watch_dirs, fwatcher);
return tb_fwatcher_add_watch(fwatcher, watchdir, recursion);
}

Expand Down