Handle EPIPE error
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 26 Nov 2018 06:33:06 +0000 (15:33 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 26 Nov 2018 07:59:57 +0000 (16:59 +0900)
The Write() Method uses send() with MSG_NOSIGNAL instead of write().

Change-Id: I20251df65375dacdc42f9a4da1d531dd3e635728
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/port-internal.cc

index 2cd3a72..34557b6 100644 (file)
@@ -134,7 +134,7 @@ int Port::Write(const void* buf, unsigned int size) {
   }
 
   while (left) {
-    nb = write(fd_, buffer, left);
+    nb = send(fd_, buffer, left, MSG_NOSIGNAL);
     if (nb == -1) {
       if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
         LOGE("write_socket: %d errno, sleep and retry ...", errno);