diff options
author | John Ankarström <john@ankarstrom.se> | 2021-07-14 23:21:01 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-07-14 23:21:01 +0200 |
commit | 2c53551735e4e9dc4b6ea664d3bfcd2a9dc479c5 (patch) | |
tree | fedf4b1e7d77bdf65e964ef566e7587e45724dbf | |
parent | 88afa3cb693fdfdbd1947d7b041f3d16730eb677 (diff) | |
download | rtty-2c53551735e4e9dc4b6ea664d3bfcd2a9dc479c5.tar.gz |
Exit when child (ssh) exits
-rw-r--r-- | rtty.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1,6 +1,7 @@ #include <err.h> #include <errno.h> #include <fcntl.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <sys/select.h> @@ -10,6 +11,12 @@ #define INIT "export TERM=tty43 EDITOR=ed PAGER='pr -ptl23'\n" #define MAXBUF 2048 +void +sigchld() +{ + exit(0); +} + int main(int argc, char *argv[]) { @@ -18,6 +25,8 @@ main(int argc, char *argv[]) int fdin, fdout, i, n; struct timeval tv; + signal(SIGCHLD, sigchld); + /* Create named pipes. */ sprintf(in, "/var/tmp/rtty.in.%d", getpid()); sprintf(out, "/var/tmp/rtty.out.%d", getpid()); |