From e5f3150688b735f42f1c36749cfd59920e0c7b59 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Mon, 29 Sep 1997 19:18:21 +0000 Subject: [PATCH] fix yes/no prompt code for EOF case; wosch@freebsd --- src/lib/libutil/passwd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/libutil/passwd.c b/src/lib/libutil/passwd.c index 4481a28a..7825dd99 100644 --- a/src/lib/libutil/passwd.c +++ b/src/lib/libutil/passwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: passwd.c,v 1.11 1997/06/22 23:57:23 millert Exp $ */ +/* $OpenBSD: passwd.c,v 1.12 1997/09/29 19:18:21 deraadt Exp $ */ /* * Copyright (c) 1987, 1993, 1994, 1995 @@ -34,7 +34,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: passwd.c,v 1.11 1997/06/22 23:57:23 millert Exp $"; +static char rcsid[] = "$OpenBSD: passwd.c,v 1.12 1997/09/29 19:18:21 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -387,14 +387,14 @@ pw_edit(notsetuid, filename) void pw_prompt() { - int c; + int first, c; (void)printf("re-edit the password file? [y]: "); (void)fflush(stdout); - c = getchar(); - if (c != EOF && c != '\n') - while (getchar() != '\n'); - if (c == 'n') + first = c = getchar(); + while (c != '\n' && c != EOF) + c = getchar(); + if (first == 'n') pw_error(NULL, 0, 0); }