diff options
author | 2012-07-10 08:42:43 +0000 | |
---|---|---|
committer | 2012-07-10 08:42:43 +0000 | |
commit | ca5f265755ebfb48d2f1a20624a7702599317ab5 (patch) | |
tree | d3a6cb1d87a0e790551d074c6398f9795b5360d4 /usr.bin/cu/command.c | |
parent | in_scrubprefix needs the same netmask checking as in_addprefix (which was (diff) | |
download | wireguard-openbsd-ca5f265755ebfb48d2f1a20624a7702599317ab5.tar.xz wireguard-openbsd-ca5f265755ebfb48d2f1a20624a7702599317ab5.zip |
Restore termios and signal handlers before ~$ so ^C will kill child.
Diffstat (limited to 'usr.bin/cu/command.c')
-rw-r--r-- | usr.bin/cu/command.c | 11 |
1 files changed, 10 insertions, 1 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 |