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:
@@ -2016,6 +2016,11 @@ duk_ret_t ILibDuktape_fs_watch(duk_context *ctx)
|
|||||||
notifyDispatcher->chainLink.QueryHandler = ILibDuktape_fs_notifyDispatcher_Query;
|
notifyDispatcher->chainLink.QueryHandler = ILibDuktape_fs_notifyDispatcher_Query;
|
||||||
notifyDispatcher->watchTable = ILibHashtable_Create();
|
notifyDispatcher->watchTable = ILibHashtable_Create();
|
||||||
notifyDispatcher->fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
|
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;
|
notifyDispatcher->ctx = ctx;
|
||||||
ILibAddToChain(chain, notifyDispatcher);
|
ILibAddToChain(chain, notifyDispatcher);
|
||||||
duk_push_pointer(ctx, notifyDispatcher); // [fs][ptr]
|
duk_push_pointer(ctx, notifyDispatcher); // [fs][ptr]
|
||||||
|
|||||||
Reference in New Issue
Block a user