aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-14 23:21:01 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-14 23:21:01 +0200
commit2c53551735e4e9dc4b6ea664d3bfcd2a9dc479c5 (patch)
treefedf4b1e7d77bdf65e964ef566e7587e45724dbf
parent88afa3cb693fdfdbd1947d7b041f3d16730eb677 (diff)
downloadrtty-2c53551735e4e9dc4b6ea664d3bfcd2a9dc479c5.tar.gz
Exit when child (ssh) exits
-rw-r--r--rtty.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/rtty.c b/rtty.c
index f54d3b2..0eb26f8 100644
--- a/rtty.c
+++ b/rtty.c
@@ -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());