Permalink
Browse files

Add a check for EINTR in write_all()

[nelhage@nelhage.com: Split out from a larger commit]
  • Loading branch information...
1 parent 3fa5657 commit 0c34e73524d0c71f66651baeba1fa27fd3f24f5d @robryk robryk committed with Feb 27, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 reptyr.c
View
5 reptyr.c
@@ -97,8 +97,11 @@ int writeall(int fd, const void *buf, ssize_t count) {
ssize_t rv;
while (count > 0) {
rv = write(fd, buf, count);
- if (rv < 0)
+ if (rv < 0) {
+ if (errno == EINTR)
+ continue;
return rv;
+ }
count -= rv;
buf += rv;
}

0 comments on commit 0c34e73

Please sign in to comment.