[PATCH 13/18] user-cr: Handle EINTR and fix EAGAIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Negative errno values are internal to the kernel so we need to get
rid of the negation before EAGAIN. Also, while we're here, handle EINTR
gracefully.

Signed-off-by: Matt Helsley <matthltc@xxxxxxxxxx>
---
 ckptinfo.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/ckptinfo.c b/ckptinfo.c
index 23db9fb..eafc2a7 100644
--- a/ckptinfo.c
+++ b/ckptinfo.c
@@ -162,8 +162,10 @@ static int __image_read(int fd, void *buf, int len)
 
 	for (nleft = len; nleft; nleft -= nread) {
 		nread = read(fd, buf, nleft);
-		if (nread < 0 && errno == -EAGAIN)
+		if (nread < 0 && ((errno == EAGAIN) || (errno == EINTR))) {
+			nread = 0;
 			continue;
+		}
 		if (nread <= 0)
 			break;
 		buf += nread;
-- 
1.6.3.3

_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers


[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux