mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
cleanup: dmeventd simplify buffer write loop
This commit is contained in:
parent
13d05211d0
commit
0503af8466
@ -1417,17 +1417,17 @@ static int _client_write(struct dm_event_fifos *fifos,
|
|||||||
if (msg->data)
|
if (msg->data)
|
||||||
memcpy(buf + 2 * sizeof(uint32_t), msg->data, msg->size);
|
memcpy(buf + 2 * sizeof(uint32_t), msg->data, msg->size);
|
||||||
|
|
||||||
errno = 0;
|
while (bytes < size) {
|
||||||
while (bytes < size && errno != EIO) {
|
|
||||||
do {
|
do {
|
||||||
/* Watch client write FIFO to be ready for output. */
|
/* Watch client write FIFO to be ready for output. */
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(fifos->server, &fds);
|
FD_SET(fifos->server, &fds);
|
||||||
} while (select(fifos->server + 1, NULL, &fds, NULL, NULL) !=
|
} while (select(fifos->server + 1, NULL, &fds, NULL, NULL) != 1);
|
||||||
1);
|
|
||||||
|
|
||||||
ret = write(fifos->server, buf + bytes, size - bytes);
|
if ((ret = write(fifos->server, buf + bytes, size - bytes)) > 0)
|
||||||
bytes += ret > 0 ? ret : 0;
|
bytes += ret;
|
||||||
|
else if (errno == EIO)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytes == size;
|
return bytes == size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user