From 35fd1d093a6c50c4289d09f61aa3407d0b6fd62a Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Mon, 29 Sep 1997 13:13:51 +0000 Subject: Endless loop. $ vipw [corrupt a line in editor, exit editor] pwd_mkdb: corrupted entry pwd_mkdb: at line #2 pwd_mkdb: /etc/pw.012585: Inappropriate file type or format re-edit the password file? [y]: n^D^D [hang] --- libutil/pw_util.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libutil/pw_util.c') diff --git a/libutil/pw_util.c b/libutil/pw_util.c index 6283b95..21e0ca5 100644 --- a/libutil/pw_util.c +++ b/libutil/pw_util.c @@ -202,14 +202,14 @@ pw_edit(notsetuid) void pw_prompt() { - int c; + int c, first; (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); } -- cgit v1.2.3