diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-07-10 07:45:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-10 16:24:24 -0400 |
commit | 9ead6feedd28091d86cde0843be914847b4e10e8 (patch) | |
tree | d477bd385e04d77d74823dbbaa4c840c235a5630 | |
parent | 108ffa8cbfa323d462a2f4b49f38da3205d36e5a (diff) |
[PATCH] uml: add some EINTR protection
Add some more uses of the CATCH_EINTR wrapper.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/um/drivers/net_user.c | 10 | ||||
-rw-r--r-- | arch/um/os-Linux/file.c | 6 |
2 files changed, 6 insertions, 10 deletions
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index 8cd851be0e4d..107c5e43fa00 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) | |||
105 | { | 105 | { |
106 | int n; | 106 | int n; |
107 | 107 | ||
108 | while(((n = recvfrom(fd, buf, len, 0, NULL, NULL)) < 0) && | 108 | CATCH_EINTR(n = recvfrom(fd, buf, len, 0, NULL, NULL)); |
109 | (errno == EINTR)) ; | ||
110 | |||
111 | if(n < 0){ | 109 | if(n < 0){ |
112 | if(errno == EAGAIN) | 110 | if(errno == EAGAIN) |
113 | return 0; | 111 | return 0; |
@@ -135,7 +133,7 @@ int net_send(int fd, void *buf, int len) | |||
135 | { | 133 | { |
136 | int n; | 134 | int n; |
137 | 135 | ||
138 | while(((n = send(fd, buf, len, 0)) < 0) && (errno == EINTR)) ; | 136 | CATCH_EINTR(n = send(fd, buf, len, 0)); |
139 | if(n < 0){ | 137 | if(n < 0){ |
140 | if(errno == EAGAIN) | 138 | if(errno == EAGAIN) |
141 | return 0; | 139 | return 0; |
@@ -150,8 +148,8 @@ int net_sendto(int fd, void *buf, int len, void *to, int sock_len) | |||
150 | { | 148 | { |
151 | int n; | 149 | int n; |
152 | 150 | ||
153 | while(((n = sendto(fd, buf, len, 0, (struct sockaddr *) to, | 151 | CATCH_EINTR(n = sendto(fd, buf, len, 0, (struct sockaddr *) to, |
154 | sock_len)) < 0) && (errno == EINTR)) ; | 152 | sock_len)); |
155 | if(n < 0){ | 153 | if(n < 0){ |
156 | if(errno == EAGAIN) | 154 | if(errno == EAGAIN) |
157 | return 0; | 155 | return 0; |
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index 367ac33c566d..189fa677085a 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include "os.h" | 18 | #include "os.h" |
19 | #include "user.h" | 19 | #include "user.h" |
20 | #include "kern_util.h" | 20 | #include "kern_util.h" |
21 | #include "user_util.h" | ||
21 | 22 | ||
22 | static void copy_stat(struct uml_stat *dst, struct stat64 *src) | 23 | static void copy_stat(struct uml_stat *dst, struct stat64 *src) |
23 | { | 24 | { |
@@ -42,10 +43,7 @@ int os_stat_fd(const int fd, struct uml_stat *ubuf) | |||
42 | struct stat64 sbuf; | 43 | struct stat64 sbuf; |
43 | int err; | 44 | int err; |
44 | 45 | ||
45 | do { | 46 | CATCH_EINTR(err = fstat64(fd, &sbuf)); |
46 | err = fstat64(fd, &sbuf); | ||
47 | } while((err < 0) && (errno == EINTR)) ; | ||
48 | |||
49 | if(err < 0) | 47 | if(err < 0) |
50 | return -errno; | 48 | return -errno; |
51 | 49 | ||