summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libcurses/tty/lib_mvcur.c8
-rw-r--r--lib/libskey/skeysubr.c8
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/libcurses/tty/lib_mvcur.c b/lib/libcurses/tty/lib_mvcur.c
index 8e7db26334a..df0a3080ade 100644
--- a/lib/libcurses/tty/lib_mvcur.c
+++ b/lib/libcurses/tty/lib_mvcur.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_mvcur.c,v 1.11 2003/03/18 16:55:54 millert Exp $ */
+/* $OpenBSD: lib_mvcur.c,v 1.12 2007/05/17 04:34:50 ray Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -982,7 +982,11 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
char buf[BUFSIZ], capname[BUFSIZ];
(void) fputs("> ", stdout);
- (void) fgets(buf, sizeof(buf), stdin);
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
+ if (ferror(stdin))
+ fputs("ferror on stdin", stderr);
+ break;
+ }
if (buf[0] == '?') {
(void) puts("? -- display this help message");
diff --git a/lib/libskey/skeysubr.c b/lib/libskey/skeysubr.c
index 7e0f5bf996a..079b2a0a136 100644
--- a/lib/libskey/skeysubr.c
+++ b/lib/libskey/skeysubr.c
@@ -9,7 +9,7 @@
*
* S/Key misc routines.
*
- * $OpenBSD: skeysubr.c,v 1.29 2006/04/10 08:06:08 deraadt Exp $
+ * $OpenBSD: skeysubr.c,v 1.30 2007/05/17 04:34:50 ray Exp $
*/
#include <stdio.h>
@@ -284,7 +284,8 @@ readpass(char *buf, int n)
/* Catch SIGINT and save old signal handler */
old_handler = signal(SIGINT, trapped);
- (void)fgets(buf, n, stdin);
+ if (fgets(buf, n, stdin) == NULL)
+ buf[0] = '\0';
rip(buf);
(void)putc('\n', stderr);
@@ -304,7 +305,8 @@ readpass(char *buf, int n)
char *
readskey(char *buf, int n)
{
- (void)fgets(buf, n, stdin);
+ if (fgets(buf, n, stdin) == NULL)
+ buf[0] = '\0';
rip(buf);
sevenbit(buf);