From 2c53551735e4e9dc4b6ea664d3bfcd2a9dc479c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 14 Jul 2021 23:21:01 +0200 Subject: Exit when child (ssh) exits --- rtty.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rtty.c b/rtty.c index f54d3b2..0eb26f8 100644 --- a/rtty.c +++ b/rtty.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -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()); -- cgit v1.2.3