Fix Receive 03/310003/1
authorIlho Kim <ilho159.kim@samsung.com>
Fri, 19 Apr 2024 05:14:36 +0000 (14:14 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Fri, 19 Apr 2024 05:20:11 +0000 (14:20 +0900)
After returning the EINTR in the first read, even if the read is successful
it regarded as the EINTR case and continue loop

Change-Id: Ia7cfa4cf60c7131b63d5a782ebf5e2b719e3c6c5
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/client-socket-internal.cc

index 241e52d99a3c71cc3b4121f219f31f5e280c9438..9a71b4efa74a8e74596b1514385d643e8056d20f 100644 (file)
@@ -115,13 +115,14 @@ int ClientSocket::Receive(void* buf, unsigned int size) {
       return -EIO;  // LCOV_EXCL_STOP
     }
 
-    if (errno == EINTR) {
-      usleep(100 * 1000);
-      continue;
-    }
+    if (bytes < 0) {
+      if (errno == EINTR) {
+        usleep(100 * 1000);
+        continue;
+      }
 
-    if (bytes < 0)
       return -errno;  // LCOV_EXCL_LINE
+    }
 
     len -= bytes;
     buffer += bytes;