handle exception case of epoll_wait
authorWonkyu Kwon <wonkyu.kwon@samsung.com>
Wed, 6 Mar 2013 03:14:45 +0000 (12:14 +0900)
committerWonkyu Kwon <wonkyu.kwon@samsung.com>
Wed, 6 Mar 2013 07:34:30 +0000 (16:34 +0900)
 - ignore error when epoll_wait is interrupted.
   restart system call by while loop

Change-Id: Ie46f3a2931e836224dc2c9657d6e4f35da7abb54

common/IPCHelper.cpp

index 11f7b16..708575a 100644 (file)
@@ -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 */
                        }
                }