summaryrefslogtreecommitdiff
path: root/daemons/dmeventd/dmeventd.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2014-04-18 14:43:13 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2014-04-18 16:50:55 +0200
commit0503af846607121e8f8019e6d0b2a98c204c2b72 (patch)
tree97e3116dc3975f91317a2c341a4ee6763813d790 /daemons/dmeventd/dmeventd.c
parent13d05211d006a63035afea44fa8a4b1222130cd5 (diff)
downloadlvm2-0503af846607121e8f8019e6d0b2a98c204c2b72.tar.gz
cleanup: dmeventd simplify buffer write loop
Diffstat (limited to 'daemons/dmeventd/dmeventd.c')
-rw-r--r--daemons/dmeventd/dmeventd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 81da166da..8dac207c9 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1417,17 +1417,17 @@ static int _client_write(struct dm_event_fifos *fifos,
if (msg->data)
memcpy(buf + 2 * sizeof(uint32_t), msg->data, msg->size);
- errno = 0;
- while (bytes < size && errno != EIO) {
+ while (bytes < size) {
do {
/* Watch client write FIFO to be ready for output. */
FD_ZERO(&fds);
FD_SET(fifos->server, &fds);
- } while (select(fifos->server + 1, NULL, &fds, NULL, NULL) !=
- 1);
+ } while (select(fifos->server + 1, NULL, &fds, NULL, NULL) != 1);
- ret = write(fifos->server, buf + bytes, size - bytes);
- bytes += ret > 0 ? ret : 0;
+ if ((ret = write(fifos->server, buf + bytes, size - bytes)) > 0)
+ bytes += ret;
+ else if (errno == EIO)
+ break;
}
return bytes == size;