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]
This commit is contained in:
Wolfram Schneider 1997-09-29 13:13:51 +00:00
parent a203eb6ef6
commit 2af22b06a4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29980
2 changed files with 10 additions and 10 deletions

View File

@ -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);
}

View File

@ -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);
}