From: Seonah Moon Date: Mon, 30 Jan 2023 13:43:55 +0000 (+0900) Subject: Fix the bug about invalid event fd X-Git-Tag: accepted/tizen/unified/20230131.162137^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a284ca297ede20167eef460e3e5a50002a7b57ff;p=platform%2Fcore%2Fapi%2Fvine.git Fix the bug about invalid event fd Change-Id: I42b29d55932d59fd875bb4ec3770ed9ebc931308 --- diff --git a/packaging/capi-network-vine.spec b/packaging/capi-network-vine.spec index 11aaee7..78f1b6b 100755 --- a/packaging/capi-network-vine.spec +++ b/packaging/capi-network-vine.spec @@ -3,7 +3,7 @@ %bcond_without use_glib_event_loop Name: capi-network-vine Summary: An service discovery framework -Version: 1.3.0 +Version: 1.3.1 Release: 0 Group: Network & Connectivity/API License: Apache-2.0 diff --git a/src/vine-event-loop-epoll.cpp b/src/vine-event-loop-epoll.cpp index 5ab153d..9170517 100755 --- a/src/vine-event-loop-epoll.cpp +++ b/src/vine-event-loop-epoll.cpp @@ -81,13 +81,17 @@ static void *__vine_event_loop_epoll_run(void *arg) } for (int i = 0; i < n; ++i) { - if (_find_io_event_handler(events[i].data.fd) == NULL) { - VINE_LOGI("Removed fd[%d]", events[i].data.fd); + vine_epoll_io_event_handler *h = (vine_epoll_io_event_handler *)events[i].data.ptr; + + if (!h) + continue; + + if (_find_io_event_handler(h->fd) == NULL) { + VINE_LOGI("Removed fd[%d]", h->fd); continue; } - vine_epoll_io_event_handler *h = (vine_epoll_io_event_handler *)events[i].data.ptr; - if (h && h->fd > 0 && h->handler) + if (h->handler) h->handler(h->fd, events[i].events, h->user_data); } } while (!__cleanup);