summaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-18 22:17:42 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-18 22:17:42 +0100
commitec70bdd68a531762a62728747ab529d7a6dfc842 (patch)
treeaf475b85074c1b1523d8eb0ea739133c6ffa802a /src/os_unix.c
parent74a97b1ea0fe2c729e26718d0eec4164c8bed151 (diff)
downloadvim-git-ec70bdd68a531762a62728747ab529d7a6dfc842.tar.gz
patch 7.4.1350v7.4.1350
Problem: When the test server fails to start Vim hangs. Solution: Check that there is actually something to read from the tty fd.
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 1f0f2c804..cebef645c 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5345,11 +5345,12 @@ WaitForChar(long msec)
#if defined(__BEOS__)
int
#else
- static int
+ static int
#endif
RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
{
int ret;
+ int result;
#if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP) || defined(FEAT_MZSCHEME)
static int busy = FALSE;
@@ -5466,6 +5467,9 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
#endif
ret = poll(fds, nfd, towait);
+
+ result = ret > 0 && (fds[0].revents & POLLIN);
+
# ifdef FEAT_MZSCHEME
if (ret == 0 && mzquantum_used)
/* MzThreads scheduling is required and timeout occurred */
@@ -5613,6 +5617,10 @@ select_eintr:
# endif
ret = select(maxfd + 1, &rfds, NULL, &efds, tvp);
+ result = ret > 0 && FD_ISSET(fd, &rfds);
+ if (result)
+ --ret;
+
# ifdef EINTR
if (ret == -1 && errno == EINTR)
{
@@ -5733,7 +5741,7 @@ select_eintr:
#endif
}
- return (ret > 0);
+ return result;
}
#ifndef NO_EXPANDPATH