summaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 74ffe9300..dc8e00952 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5539,7 +5539,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *break_loop)
# endif
#endif
#ifndef HAVE_SELECT
- struct pollfd fds[6 + MAX_OPEN_CHANNELS];
+ /* each channel may use in, out and err */
+ struct pollfd fds[6 + 3 * MAX_OPEN_CHANNELS];
int nfd;
# ifdef FEAT_XCLIPBOARD
int xterm_idx = -1;
@@ -5652,7 +5653,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *break_loop)
struct timeval tv;
struct timeval *tvp;
- fd_set rfds, efds;
+ fd_set rfds, wfds, efds;
int maxfd;
long towait = msec;
@@ -5685,6 +5686,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *break_loop)
*/
select_eintr:
FD_ZERO(&rfds);
+ FD_ZERO(&wfds);
FD_ZERO(&efds);
FD_SET(fd, &rfds);
# if !defined(__QNX__) && !defined(__CYGWIN32__)
@@ -5725,10 +5727,10 @@ select_eintr:
}
# endif
# ifdef FEAT_JOB_CHANNEL
- maxfd = channel_select_setup(maxfd, &rfds);
+ maxfd = channel_select_setup(maxfd, &rfds, &wfds);
# endif
- ret = select(maxfd + 1, &rfds, NULL, &efds, tvp);
+ ret = select(maxfd + 1, &rfds, &wfds, &efds, tvp);
result = ret > 0 && FD_ISSET(fd, &rfds);
if (result)
--ret;
@@ -5810,7 +5812,7 @@ select_eintr:
# endif
#ifdef FEAT_JOB_CHANNEL
if (ret > 0)
- ret = channel_select_check(ret, &rfds);
+ ret = channel_select_check(ret, &rfds, &wfds);
#endif
#endif /* HAVE_SELECT */