From ddeb1fd9b8aaaeaf95b81982f146dd458d2dc31a Mon Sep 17 00:00:00 2001 From: Wonkyu Kwon Date: Wed, 6 Mar 2013 12:14:45 +0900 Subject: [PATCH] handle exception case of epoll_wait - ignore error when epoll_wait is interrupted. restart system call by while loop Change-Id: Ie46f3a2931e836224dc2c9657d6e4f35da7abb54 --- common/IPCHelper.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/common/IPCHelper.cpp b/common/IPCHelper.cpp index 11f7b16..708575a 100644 --- a/common/IPCHelper.cpp +++ b/common/IPCHelper.cpp @@ -197,7 +197,6 @@ ERROR : #ifdef USE_IPC_EPOLL int events = 0; -again : if ((events = epoll_wait(fdPoll, pollEvents, EPOLL_SIZE, -1)) > 0) { int i; @@ -219,15 +218,15 @@ again : } } } + else if (errno == EINTR) + { + SCARD_DEBUG_ERR("epoll_wait interrupted"); + } else { - if (errno == EINTR) - { - char buffer[1024]; + char buffer[1024]; - SCARD_DEBUG_ERR("epoll_wait failed [%d], errno [%d], %s", events, errno, strerror_r(errno, buffer, sizeof(buffer))); - goto again; - } + SCARD_DEBUG_ERR("epoll_wait failed, errno [%d], %s", errno, strerror_r(errno, buffer, sizeof(buffer))); } #else if (select(ipcSocket + 1, &fdSetRead, NULL, NULL, NULL) > 0) @@ -309,8 +308,7 @@ again : } else { - helper->handleInvalidSocketCondition(NULL, G_IO_NVAL); - condition = false; + /* skip other error case */ } } -- 2.7.4