summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorwosch <wosch@FreeBSD.org>1997-09-29 13:13:51 +0000
committerwosch <wosch@FreeBSD.org>1997-09-29 13:13:51 +0000
commite4b768f0eec47b4fd52a9340bc45a66fe126e59a (patch)
tree3ac2cd986a932ccf59b0c5387c873c57c7f566fe /lib
parent31f0560e23509dd3eda781f63521d51913dd8fd6 (diff)
downloadFreeBSD-src-e4b768f0eec47b4fd52a9340bc45a66fe126e59a.zip
FreeBSD-src-e4b768f0eec47b4fd52a9340bc45a66fe126e59a.tar.gz
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 'lib')
-rw-r--r--lib/libutil/pw_util.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c
index 6283b95..21e0ca5 100644
--- a/lib/libutil/pw_util.c
+++ b/lib/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);
}
OpenPOWER on IntegriCloud