diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-09-29 19:18:22 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-09-29 19:18:22 +0000 |
commit | d3619e5a45c6599104268c6777ae0b70083ab332 (patch) | |
tree | 47fe0dd719b04d006f0ae1178a71574b65810d2c /lib | |
parent | 9c67612e29ee9289a16d5309884530d8ce3864d1 (diff) |
fix yes/no prompt code for EOF case; wosch@freebsd
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libutil/passwd.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c index 4481a28abc3..7825dd99a9b 100644 --- a/lib/libutil/passwd.c +++ b/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 <sys/types.h> @@ -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); } |