mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-27 04:28:20 +00:00
transfused: improve write_exactly error handling
Signed-off-by: David Sheets <dsheets@docker.com>
This commit is contained in:
parent
6b1ef63d79
commit
78328cf026
@ -303,10 +303,12 @@ void write_exactly(char *descr, int fd, void *p, size_t nbyte)
|
|||||||
char *buf = p;
|
char *buf = p;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* TODO: socket write conditions e.g.EAGAIN */
|
|
||||||
write_count = write(fd, buf, nbyte);
|
write_count = write(fd, buf, nbyte);
|
||||||
if (write_count < 0)
|
if (write_count < 0) {
|
||||||
|
if (errno == EINTR || errno == EAGAIN)
|
||||||
|
continue;
|
||||||
die(1, NULL, "", "%s: error writing: ", descr);
|
die(1, NULL, "", "%s: error writing: ", descr);
|
||||||
|
}
|
||||||
if (write_count == 0)
|
if (write_count == 0)
|
||||||
die(1, NULL, "", "%s: 0 write: ", descr);
|
die(1, NULL, "", "%s: 0 write: ", descr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user