1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00

devmapper-event: always initialize timeout

Before calling select, always set all struct members of timeout.
This commit is contained in:
Zdenek Kabelac 2014-04-18 11:31:59 +02:00
parent 08e7de986c
commit db0045dfc9

View File

@ -291,7 +291,6 @@ static int _daemon_write(struct dm_event_fifos *fifos,
uint32_t *header = alloca(size);
char *buf = (char *)header;
char drainbuf[128];
struct timeval tval = { 0, 0 };
header[0] = htonl(msg->cmd);
header[1] = htonl(msg->size);
@ -299,9 +298,9 @@ static int _daemon_write(struct dm_event_fifos *fifos,
/* drain the answer fifo */
while (1) {
struct timeval tval = { .tv_usec = 100 };
FD_ZERO(&fds);
FD_SET(fifos->server, &fds);
tval.tv_usec = 100;
ret = select(fifos->server + 1, &fds, NULL, NULL, &tval);
if ((ret < 0) && (errno != EINTR)) {
log_error("Unable to talk to event daemon");