Problem: Wayland: timeout not updated before select()
Solution: Always set timeval struct before select() (Foxe Chen).
closes: #17836
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
- tv.tv_sec = 0;
- tv.tv_usec = p_wtm * 1000;
#endif
// Make pipe (read end) non-blocking
poll_data:
#ifndef HAVE_SELECT
if (poll(&pfd, 1, p_wtm) > 0)
+ continue;
#else
+ tv.tv_sec = 0;
+ tv.tv_usec = p_wtm * 1000;
if (select(fd + 1, &rfds, NULL, NULL, &tv) > 0)
-#endif
continue;
+#endif
}
break;
}
if (written == -1)
break;
total += written;
+
+#ifdef HAVE_SELECT
+ tv.tv_sec = 0;
+ tv.tv_usec = p_wtm * 1000;
+#endif
}
exit:
vim_free(string);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1587,
/**/
1586,
/**/
if (select(display->fd + 1, NULL, &wfds, NULL, &tv) <= 0)
#endif
return FAIL;
+#ifdef HAVE_SELECT
+ tv.tv_sec = 0;
+ tv.tv_usec = p_wtm * 1000;
+#endif
}
// Return FAIL on error or timeout
if ((errno != 0 && errno != EAGAIN) || ret == -1)