]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1587: Wayland: timeout not updated before select() v9.1.1587
authorFoxe Chen <chen.foxe@gmail.com>
Thu, 24 Jul 2025 17:29:13 +0000 (19:29 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 24 Jul 2025 17:29:13 +0000 (19:29 +0200)
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>
src/clipboard.c
src/version.c
src/wayland.c

index 7552751225ec8d0738f0bc2e5e7e09cfd36516ae..a22b6214522d101aebe0be52173d49b29437b3f1 100644 (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)
+                   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;
        }
@@ -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);
index b0382651c5ce40c0a5171d2aedcd6bfc63ae1240..16148447b0517d0f6ff91e9e041b5fb619c9e511 100644 (file)
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1587,
 /**/
     1586,
 /**/
index bf09443757f99b2c674396e7a22ae22bc7a3f1ce..b09ec5f6b9218e3a26c089172d7f4e6148d169f5 100644 (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)