0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.1.1587: Wayland: timeout not updated before select()

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>
This commit is contained in:
Foxe Chen 2025-07-24 19:29:13 +02:00 committed by Christian Brabandt
parent 9239eadc71
commit 1a224edb2e
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
3 changed files with 17 additions and 5 deletions

View File

@ -2352,8 +2352,6 @@ clip_wl_receive_data(Clipboard_T *cbd, const char *mime_type, int fd)
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
tv.tv_sec = 0;
tv.tv_usec = p_wtm * 1000;
#endif
// Make pipe (read end) non-blocking
@ -2381,10 +2379,13 @@ clip_wl_receive_data(Clipboard_T *cbd, const char *mime_type, int fd)
poll_data:
#ifndef HAVE_SELECT
if (poll(&pfd, 1, p_wtm) > 0)
#else
if (select(fd + 1, &rfds, NULL, NULL, &tv) > 0)
#endif
continue;
#else
tv.tv_sec = 0;
tv.tv_usec = p_wtm * 1000;
if (select(fd + 1, &rfds, NULL, NULL, &tv) > 0)
continue;
#endif
}
break;
}
@ -2617,6 +2618,11 @@ clip_wl_send_data(
if (written == -1)
break;
total += written;
#ifdef HAVE_SELECT
tv.tv_sec = 0;
tv.tv_usec = p_wtm * 1000;
#endif
}
exit:
vim_free(string);

View File

@ -719,6 +719,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1587,
/**/
1586,
/**/

View File

@ -422,6 +422,10 @@ vwl_display_flush(vwl_display_T *display)
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)