mirror of
https://git.savannah.gnu.org/git/screen.git
synced 2026-04-19 10:15:50 +02:00
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:
11
src/screen.c
11
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 */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user