diff options
-rw-r--r-- | usr.bin/cu/command.c | 11 | ||||
-rw-r--r-- | usr.bin/cu/cu.c | 7 |
2 files changed, 16 insertions, 2 deletions
diff --git a/usr.bin/cu/command.c b/usr.bin/cu/command.c index 6d17897d393..a6d9b80b95d 100644 --- a/usr.bin/cu/command.c +++ b/usr.bin/cu/command.c @@ -1,4 +1,4 @@ -/* $OpenBSD: command.c,v 1.2 2012/07/10 08:16:27 nicm Exp $ */ +/* $OpenBSD: command.c,v 1.3 2012/07/10 08:42:43 nicm Exp $ */ /* * Copyright (c) 2012 Nicholas Marriott <nicm@openbsd.org> @@ -46,6 +46,8 @@ pipe_command(void) if (cmd == NULL || *cmd == '\0') return; + restore_termios(); + switch (pid = fork()) { case -1: err(1, "fork"); @@ -55,6 +57,11 @@ pipe_command(void) _exit(1); close(fd); + if (signal(SIGINT, SIG_DFL) == SIG_ERR) + _exit(1); + if (signal(SIGQUIT, SIG_DFL) == SIG_ERR) + _exit(1); + /* attach stdout to line */ if (dup2(line_fd, STDOUT_FILENO) == -1) _exit(1); @@ -69,6 +76,8 @@ pipe_command(void) /* nothing */; break; } + + set_termios(); } void diff --git a/usr.bin/cu/cu.c b/usr.bin/cu/cu.c index 13d4e5b1273..ee87334b728 100644 --- a/usr.bin/cu/cu.c +++ b/usr.bin/cu/cu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cu.c,v 1.2 2012/07/10 08:16:27 nicm Exp $ */ +/* $OpenBSD: cu.c,v 1.3 2012/07/10 08:42:43 nicm Exp $ */ /* * Copyright (c) 2012 Nicholas Marriott <nicm@openbsd.org> @@ -138,8 +138,13 @@ getopt: err(1, "tcgetattr"); event_init(); + signal_set(&sigterm_ev, SIGTERM, signal_event, NULL); signal_add(&sigterm_ev, NULL); + if (signal(SIGINT, SIG_IGN) == SIG_ERR) + err(1, "signal"); + if (signal(SIGQUIT, SIG_IGN) == SIG_ERR) + err(1, "signal"); set_termios(); |