mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-28 23:23:30 +08:00
tools: kwboot: Handle EINTR in kwboot_write()
The write() syscall may be interrupted. Handle EINTR and retry it. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
8d3b79c4a3
commit
6ba7d63e01
@ -292,13 +292,15 @@ static int blk_rsp_timeo = KWBOOT_BLK_RSP_TIMEO;
|
||||
static ssize_t
|
||||
kwboot_write(int fd, const char *buf, size_t len)
|
||||
{
|
||||
size_t tot = 0;
|
||||
ssize_t tot = 0;
|
||||
|
||||
while (tot < len) {
|
||||
ssize_t wr = write(fd, buf + tot, len - tot);
|
||||
|
||||
if (wr < 0)
|
||||
return -1;
|
||||
if (wr < 0 && errno == EINTR)
|
||||
continue;
|
||||
else if (wr < 0)
|
||||
return wr;
|
||||
|
||||
tot += wr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user