summaryrefslogtreecommitdiffstats
path: root/libutil
diff options
context:
space:
mode:
authorWolfram Schneider <wosch@FreeBSD.org>1997-09-29 13:13:51 +0000
committerWolfram Schneider <wosch@FreeBSD.org>1997-09-29 13:13:51 +0000
commit35fd1d093a6c50c4289d09f61aa3407d0b6fd62a (patch)
treec00124587bc5108ab336e951edfe3ae6f3dc8da1 /libutil
parent9528aa4795309d9cc7e5fafb2ae3563ccd8f4adf (diff)
downloadpw-darwin-35fd1d093a6c50c4289d09f61aa3407d0b6fd62a.tar.gz
pw-darwin-35fd1d093a6c50c4289d09f61aa3407d0b6fd62a.tar.zst
pw-darwin-35fd1d093a6c50c4289d09f61aa3407d0b6fd62a.zip
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]
Diffstat (limited to 'libutil')
-rw-r--r--libutil/pw_util.c10
1 files changed, 5 insertions, 5 deletions
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);
}