From: Jeff Dike Date: Mon, 10 Jul 2006 11:45:15 +0000 (-0700) Subject: [PATCH] uml: add some EINTR protection X-Git-Tag: v2.6.18-rc2~151 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ead6feedd28091d86cde0843be914847b4e10e8;p=linux-2.6 [PATCH] uml: add some EINTR protection Add some more uses of the CATCH_EINTR wrapper. Signed-off-by: Jeff Dike Cc: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index 8cd851be0e..107c5e43fa 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c @@ -105,9 +105,7 @@ int net_recvfrom(int fd, void *buf, int len) { int n; - while(((n = recvfrom(fd, buf, len, 0, NULL, NULL)) < 0) && - (errno == EINTR)) ; - + CATCH_EINTR(n = recvfrom(fd, buf, len, 0, NULL, NULL)); if(n < 0){ if(errno == EAGAIN) return 0; @@ -135,7 +133,7 @@ int net_send(int fd, void *buf, int len) { int n; - while(((n = send(fd, buf, len, 0)) < 0) && (errno == EINTR)) ; + CATCH_EINTR(n = send(fd, buf, len, 0)); if(n < 0){ if(errno == EAGAIN) return 0; @@ -150,8 +148,8 @@ int net_sendto(int fd, void *buf, int len, void *to, int sock_len) { int n; - while(((n = sendto(fd, buf, len, 0, (struct sockaddr *) to, - sock_len)) < 0) && (errno == EINTR)) ; + CATCH_EINTR(n = sendto(fd, buf, len, 0, (struct sockaddr *) to, + sock_len)); if(n < 0){ if(errno == EAGAIN) return 0; diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index 367ac33c56..189fa67708 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c @@ -18,6 +18,7 @@ #include "os.h" #include "user.h" #include "kern_util.h" +#include "user_util.h" static void copy_stat(struct uml_stat *dst, struct stat64 *src) { @@ -42,10 +43,7 @@ int os_stat_fd(const int fd, struct uml_stat *ubuf) struct stat64 sbuf; int err; - do { - err = fstat64(fd, &sbuf); - } while((err < 0) && (errno == EINTR)) ; - + CATCH_EINTR(err = fstat64(fd, &sbuf)); if(err < 0) return -errno;