summaryrefslogtreecommitdiffstats
path: root/usr.bin/rcs/rcsutil.c
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2007-01-10 02:13:23 +0000
committerray <ray@openbsd.org>2007-01-10 02:13:23 +0000
commitf8a4e2aa122ba996758fbe83ab3c042d8964747d (patch)
tree8ed1da902182e6886777ce0ab2a77882759485ea /usr.bin/rcs/rcsutil.c
parentAdjust for USIII to RIO EBus renaming. (diff)
downloadwireguard-openbsd-f8a4e2aa122ba996758fbe83ab3c042d8964747d.tar.xz
wireguard-openbsd-f8a4e2aa122ba996758fbe83ab3c042d8964747d.zip
Clear EOF before prompting user for input.
Fixes PR 5342. OK joris@ and xsa@.
Diffstat (limited to 'usr.bin/rcs/rcsutil.c')
-rw-r--r--usr.bin/rcs/rcsutil.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c
index f8b13948210..e9b7218570a 100644
--- a/usr.bin/rcs/rcsutil.c
+++ b/usr.bin/rcs/rcsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsutil.c,v 1.24 2007/01/02 16:43:45 niallo Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.25 2007/01/10 02:13:23 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -343,6 +343,7 @@ rcs_prompt(const char *prompt)
(void)fprintf(stderr, "%s", prompt);
if (isatty(STDIN_FILENO))
(void)fprintf(stderr, ">> ");
+ clearerr(stdin);
while ((buf = fgetln(stdin, &len)) != NULL) {
/* The last line may not be EOL terminated. */
if (buf[0] == '.' && (len == 1 || buf[1] == '\n'))
@@ -564,6 +565,7 @@ rcs_yesno(int defc)
fflush(stderr);
fflush(stdout);
+ clearerr(stdin);
if (isalpha(c = getchar()))
c = tolower(c);
if (c == defc || c == '\n' || (c == EOF && feof(stdin)))