From: Sung-Jin Park Date: Tue, 9 Nov 2021 03:31:11 +0000 (+0900) Subject: pepper-inotify: correct to no longer read if an error occurs in fd X-Git-Tag: submit/tizen/20210606.040058~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f49ae4974eed225a15788044a06e9388efefc898;p=platform%2Fcore%2Fuifw%2Fpepper.git pepper-inotify: correct to no longer read if an error occurs in fd Change-Id: Ic23a223758ae77056fe31cd0a0210abc2a84ef5f Signed-off-by: Sung-Jin Park --- diff --git a/src/lib/inotify/pepper-inotify.c b/src/lib/inotify/pepper-inotify.c index cf11875..727be5a 100644 --- a/src/lib/inotify/pepper-inotify.c +++ b/src/lib/inotify/pepper-inotify.c @@ -81,10 +81,17 @@ _inotify_fd_read(int fd, uint32_t mask, void *data) struct inotify_event ev[32]; pepper_inotify_watch_t *watch_data = data; - PEPPER_CHECK(!(mask & (WL_EVENT_HANGUP | WL_EVENT_ERROR)), - return 0, - "[%s] With the given fd, there is an error or it's been hung-up.\n", - __FUNCTION__); + if ((mask & WL_EVENT_HANGUP) || (mask & WL_EVENT_ERROR)) + { + PEPPER_ERROR("With the given fd(%d, mask:0x%x), there is an error or it's been hung-up. (errno:%m)\n", fd, mask); + PEPPER_ERROR("The event source will be disabled and the fd will be closed.\n"); + + if (watch_data->event_source) + wl_event_source_fd_update(watch_data->event_source, (uint32_t)0); + + close(fd); + return 0; + } if (!(mask & WL_EVENT_READABLE)) return 0;