Convert select() to poll() in screen.c

select() limits number of file descriptors that can be used by screen.
Migrate to poll() to avoid this limitation.

Bug: 55697

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
This commit is contained in:
Amadeusz Sławiński
2019-11-03 00:31:58 +01:00
parent f253ff920c
commit 88add631de

View File

@@ -34,6 +34,7 @@
#include <ctype.h>
#include <fcntl.h>
#include <poll.h>
#include <pwd.h>
#include <signal.h>
#include <stdint.h>
@@ -1036,14 +1037,14 @@ int main(int argc, char **argv)
if (mru_window == NULL) {
if (MakeWindow(&nwin) == -1) {
fd_set rfd;
FD_ZERO(&rfd);
struct timeval tv = { MsgWait / 1000, 1000 * (MsgWait % 1000) };
FD_SET(0, &rfd);
struct pollfd pfd[1];
pfd[0].fd = 0;
pfd[0].events = POLLIN;
Msg(0, "Sorry, could not find a PTY or TTY.");
/* allow user to exit early by pressing any key. */
select(1, &rfd, NULL, NULL, &tv);
poll(pfd, ARRAY_SIZE(pfd), MsgWait);
Finit(0);
/* NOTREACHED */
}