From 0bd36a4998aba43b8db0abe76ce0897373a9a1e2 Mon Sep 17 00:00:00 2001 From: Sunwook Bae Date: Sat, 11 May 2013 11:24:29 +0900 Subject: [PATCH] Prevent fix Change-Id: Id8a1e13c8651ffa51025ad1bc6a2d47b7dc47d28 Signed-off-by: Sunwook Bae --- src/io/FIo_IpcClient.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/io/FIo_IpcClient.cpp b/src/io/FIo_IpcClient.cpp index d403f64..1fd53cd 100644 --- a/src/io/FIo_IpcClient.cpp +++ b/src/io/FIo_IpcClient.cpp @@ -539,12 +539,25 @@ _IpcClient::SendSync(IPC::Message* pMessage) pfd.events = POLLIN | POLLRDHUP; pfd.revents = 0; + int ret = 0; + while (true) { - poll(&pfd, 1, -1); + ret = poll(&pfd, 1, -1); + if (ret < 0) + { + if (errno == EINTR) + { + continue; + } + + SysLogException(NID_IO, E_SYSTEM, "[E_SYSTEM] Failed to poll (%d, %s).", errno, strerror(errno)); + return E_SYSTEM; + } if (pfd.revents & POLLRDHUP) { + SysLogException(NID_IO, E_SYSTEM, "[E_SYSTEM] POLLRDHUP"); return E_SYSTEM; } @@ -553,7 +566,10 @@ _IpcClient::SendSync(IPC::Message* pMessage) readSize = read(fd, buffer, 1024); } - message.append(buffer, readSize); + if (readSize > 0) + { + message.append(buffer, readSize); + } pEndOfMessage = (char*) IPC::Message::FindNext(message.data(), message.data() + message.size()); if (pEndOfMessage) -- 2.7.4