mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-17 06:04:23 +03:00
devmapper-event: always initialize timeout
Always pass fully initialized timeval struct to select.
This commit is contained in:
parent
675fcfe9b7
commit
816cc94ac1
@ -224,7 +224,6 @@ static int _daemon_read(struct dm_event_fifos *fifos,
|
|||||||
unsigned bytes = 0;
|
unsigned bytes = 0;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
struct timeval tval = { 0, 0 };
|
|
||||||
size_t size = 2 * sizeof(uint32_t); /* status + size */
|
size_t size = 2 * sizeof(uint32_t); /* status + size */
|
||||||
uint32_t *header = alloca(size);
|
uint32_t *header = alloca(size);
|
||||||
char *buf = (char *)header;
|
char *buf = (char *)header;
|
||||||
@ -232,11 +231,10 @@ static int _daemon_read(struct dm_event_fifos *fifos,
|
|||||||
while (bytes < size) {
|
while (bytes < size) {
|
||||||
for (i = 0, ret = 0; (i < 20) && (ret < 1); i++) {
|
for (i = 0, ret = 0; (i < 20) && (ret < 1); i++) {
|
||||||
/* Watch daemon read FIFO for input. */
|
/* Watch daemon read FIFO for input. */
|
||||||
|
struct timeval tval = { .tv_sec = 1 };
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(fifos->server, &fds);
|
FD_SET(fifos->server, &fds);
|
||||||
tval.tv_sec = 1;
|
ret = select(fifos->server + 1, &fds, NULL, NULL, &tval);
|
||||||
ret = select(fifos->server + 1, &fds, NULL, NULL,
|
|
||||||
&tval);
|
|
||||||
if (ret < 0 && errno != EINTR) {
|
if (ret < 0 && errno != EINTR) {
|
||||||
log_error("Unable to read from event server");
|
log_error("Unable to read from event server");
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user