Delta-vlogin-efds.diff: Difference between revisions
(Restored content from Wayback Machine) |
(No difference)
|
Latest revision as of 00:15, 11 November 2025
Index: src/vlogin.c =================================================================== --- src/vlogin.c (revision 2472) +++ src/vlogin.c (working copy) @@ -188,6 +188,11 @@ terminal_redraw(); break; + /* terminal hangup */ + case SIGHUP: + terminal_kill(sig); + break; + default: exit(0); } @@ -200,6 +205,7 @@ pid_t pid; int n, i; fd_set rfds; + fd_set efds; if (!isatty(0) || !isatty(1)) { execvp(argv[ind], argv+ind); @@ -245,6 +251,7 @@ /* setup SIGINT and SIGWINCH here, as they can cause loops in the child */ signal(SIGWINCH, signal_handler); signal(SIGINT, signal_handler); + signal(SIGHUP, signal_handler); /* save terminals pid */ t.pid = pid; @@ -264,18 +271,23 @@ for (;;) { /* init file descriptors for select */ FD_ZERO(&rfds); + FD_ZERO(&efds); FD_SET(STDIN_FILENO, &rfds); + FD_SET(STDIN_FILENO, &efds); FD_SET(t.fd, &rfds); n = t.fd; /* wait for something to happen */ - while (select(n + 1, &rfds, NULL, NULL, NULL) == -1) { + while (select(n + 1, &rfds, NULL, &efds, NULL) == -1) { if (errno == EINTR || errno == EAGAIN) continue; perror(ENSC_WRAPPERS_PREFIX "select()"); exit(wrapper_exit_code); } + if (FD_ISSET(STDIN_FILENO, &efds)) + terminal_kill(SIGHUP); + if (FD_ISSET(STDIN_FILENO, &rfds)) terminal_copy(STDIN_FILENO, t.fd);