summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmadeusz Sławiński <amade@asmblr.net>2019-11-03 00:31:58 +0100
committerAmadeusz Sławiński <amade@asmblr.net>2019-12-28 13:41:48 +0100
commit88add631deef0618941f740108a02fbabecc52cf (patch)
treec171c6c7a1ce82107768d3448467c32899ba32e0
parentf253ff920cfa622f879a8cfff3afcf6b4f6d9779 (diff)
downloadscreen-88add631deef0618941f740108a02fbabecc52cf.tar.gz
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>
-rw-r--r--src/screen.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/screen.c b/src/screen.c
index c56f214..53d00f2 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -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 */
}