1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-22 11:13:21 +00:00

Updated FSWatcher on linux, to re-init FD if it is 0

This commit is contained in:
Bryan Roe
2022-03-03 22:26:07 -08:00
parent 93b4a3b6dd
commit 6460a09542

View File

@@ -2016,6 +2016,11 @@ duk_ret_t ILibDuktape_fs_watch(duk_context *ctx)
notifyDispatcher->chainLink.QueryHandler = ILibDuktape_fs_notifyDispatcher_Query;
notifyDispatcher->watchTable = ILibHashtable_Create();
notifyDispatcher->fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
if (notifyDispatcher->fd == 0)
{
notifyDispatcher->fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
close(0);
}
notifyDispatcher->ctx = ctx;
ILibAddToChain(chain, notifyDispatcher);
duk_push_pointer(ctx, notifyDispatcher); // [fs][ptr]