summaryrefslogtreecommitdiffstats
path: root/usr.bin/cu/command.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-07-10 08:42:43 +0000
committernicm <nicm@openbsd.org>2012-07-10 08:42:43 +0000
commitca5f265755ebfb48d2f1a20624a7702599317ab5 (patch)
treed3a6cb1d87a0e790551d074c6398f9795b5360d4 /usr.bin/cu/command.c
parentin_scrubprefix needs the same netmask checking as in_addprefix (which was (diff)
downloadwireguard-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.c11
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