summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2014-07-14 05:54:12 +0000
committerderaadt <deraadt@openbsd.org>2014-07-14 05:54:12 +0000
commit171c927c7dd9d5b3f09124960c1adc7411691194 (patch)
tree981334c201c1bfbde4a52409f7d93d0e04e29908
parentInstead of using a variable format string to change the field width, (diff)
downloadwireguard-openbsd-171c927c7dd9d5b3f09124960c1adc7411691194.tar.xz
wireguard-openbsd-171c927c7dd9d5b3f09124960c1adc7411691194.zip
Repair handling of ^C and ^D around command prompts, by inserting
correct newlines. Of course, that means removing stdio use from signal handlers. Can we find someone to rewrite the entire interactive half of this program? ok guenther
-rw-r--r--usr.bin/ftp/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index e67b75b1859..5d68d21b015 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.89 2014/07/11 18:19:45 halex Exp $ */
+/* $OpenBSD: main.c,v 1.90 2014/07/14 05:54:12 deraadt Exp $ */
/* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */
/*
@@ -467,8 +467,12 @@ main(volatile int argc, char *argv[])
void
intr(void)
{
+ int save_errno = errno;
+ write(fileno(ttyout), "\n\r", 2);
alarmtimer(0);
+
+ errno = save_errno;
longjmp(toplevel, 1);
}
@@ -552,8 +556,11 @@ cmdscanner(int top)
const char *buf;
cursor_pos = NULL;
- if ((buf = el_gets(el, &num)) == NULL || num == 0)
+ if ((buf = el_gets(el, &num)) == NULL || num == 0) {
+ putc('\n', ttyout);
+ fflush(ttyout);
quit(0, 0);
+ }
if (buf[--num] == '\n') {
if (num == 0)
break;