mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dmeventd: fix test for select return value
Do not call read when select return -1 && EINTR. Also check for return valuer from read() and abort write function when unexpected error happens.
This commit is contained in:
parent
84860fd54f
commit
6d7f260f92
@ -297,13 +297,21 @@ static int _daemon_write(struct dm_event_fifos *fifos,
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fifos->server, &fds);
|
||||
ret = select(fifos->server + 1, &fds, NULL, NULL, &tval);
|
||||
if ((ret < 0) && (errno != EINTR)) {
|
||||
if (ret < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
log_error("Unable to talk to event daemon");
|
||||
return 0;
|
||||
}
|
||||
if (ret == 0)
|
||||
break;
|
||||
ret = read(fifos->server, drainbuf, sizeof(drainbuf));
|
||||
if (ret < 0) {
|
||||
if ((errno == EINTR) || (errno == EAGAIN))
|
||||
continue;
|
||||
log_error("Unable to talk to event daemon");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
while (bytes < size) {
|
||||
|
Loading…
Reference in New Issue
Block a user