Skip to content

Commit

Permalink
Fix a bug when writing fails with EAGAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
npmccallum committed Jun 24, 2017
1 parent 5827a17 commit 4fccbc3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libluksmeta.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ writeall(int fd, const void *buf, size_t size)

for (ssize_t r, t = 0; t < (ssize_t) size; t += r) {
r = write(fd, &tmp[t], size - t);
if (r < 0 && errno != EAGAIN)
return -errno;
if (r < 0) {
if (errno != EAGAIN)
return -errno;
r = 0;
}
}

return size;
Expand Down

0 comments on commit 4fccbc3

Please sign in to comment.