summaryrefslogtreecommitdiff
path: root/bin/csh
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2017-06-22 18:05:32 +0000
committeranton <anton@cvs.openbsd.org>2017-06-22 18:05:32 +0000
commit8e662556af41a79fce34cba96788bcbdfc46141d (patch)
tree616135cd4ac789c151d8bbb449a0d3c6d4381b6a /bin/csh
parent36b817661da70f1a7b093957231f3c1cfc851b63 (diff)
Make sure to abort loops when pressing ^C in csh.
Regression found by deraadt@
Diffstat (limited to 'bin/csh')
-rw-r--r--bin/csh/file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/csh/file.c b/bin/csh/file.c
index 867dee4b2f6..68b0c16e218 100644
--- a/bin/csh/file.c
+++ b/bin/csh/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.26 2017/06/21 19:36:23 anton Exp $ */
+/* $OpenBSD: file.c,v 1.27 2017/06/22 18:05:31 anton Exp $ */
/* $NetBSD: file.c,v 1.11 1996/11/08 19:34:37 christos Exp $ */
/*-
@@ -224,6 +224,11 @@ static int
cl_abort(struct cmdline *cl, int c)
{
cl_visc(cl, c);
+
+ /* Abort while/foreach loop prematurely. */
+ if (whyles)
+ kill(getpid(), SIGINT);
+
cl_putc(cl, '\n');
cl->len = cl->cursor = 0;
cl->flags |= CL_PROMPT;