Skip to content

Commit 1a224ed

Browse files
64-bitmanchrisbra
authored andcommitted
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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 9239ead commit 1a224ed

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/clipboard.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,8 +2352,6 @@ clip_wl_receive_data(Clipboard_T *cbd, const char *mime_type, int fd)
23522352

23532353
FD_ZERO(&rfds);
23542354
FD_SET(fd, &rfds);
2355-
tv.tv_sec = 0;
2356-
tv.tv_usec = p_wtm * 1000;
23572355
#endif
23582356

23592357
// Make pipe (read end) non-blocking
@@ -2381,10 +2379,13 @@ clip_wl_receive_data(Clipboard_T *cbd, const char *mime_type, int fd)
23812379
poll_data:
23822380
#ifndef HAVE_SELECT
23832381
if (poll(&pfd, 1, p_wtm) > 0)
2382+
continue;
23842383
#else
2384+
tv.tv_sec = 0;
2385+
tv.tv_usec = p_wtm * 1000;
23852386
if (select(fd + 1, &rfds, NULL, NULL, &tv) > 0)
2386-
#endif
23872387
continue;
2388+
#endif
23882389
}
23892390
break;
23902391
}
@@ -2617,6 +2618,11 @@ clip_wl_send_data(
26172618
if (written == -1)
26182619
break;
26192620
total += written;
2621+
2622+
#ifdef HAVE_SELECT
2623+
tv.tv_sec = 0;
2624+
tv.tv_usec = p_wtm * 1000;
2625+
#endif
26202626
}
26212627
exit:
26222628
vim_free(string);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ static char *(features[]) =
719719

720720
static int included_patches[] =
721721
{ /* Add new patch number below this line */
722+
/**/
723+
1587,
722724
/**/
723725
1586,
724726
/**/

src/wayland.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ vwl_display_flush(vwl_display_T *display)
422422
if (select(display->fd + 1, NULL, &wfds, NULL, &tv) <= 0)
423423
#endif
424424
return FAIL;
425+
#ifdef HAVE_SELECT
426+
tv.tv_sec = 0;
427+
tv.tv_usec = p_wtm * 1000;
428+
#endif
425429
}
426430
// Return FAIL on error or timeout
427431
if ((errno != 0 && errno != EAGAIN) || ret == -1)

0 commit comments

Comments
 (0)