0
0
mirror of https://github.com/vim/vim.git synced 2025-10-26 09:14:23 -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
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);