Treat EOF at whatnow prompt like 'x' instead of looping.
This commit is contained in:
22
visudo.c
22
visudo.c
@@ -428,17 +428,21 @@ whatnow()
|
|||||||
for (c = choice; c != '\n' && c != EOF;)
|
for (c = choice; c != '\n' && c != EOF;)
|
||||||
c = getchar();
|
c = getchar();
|
||||||
|
|
||||||
if (choice == 'e' || choice == 'x' || choice == 'Q')
|
switch (choice) {
|
||||||
break;
|
case EOF:
|
||||||
else {
|
choice = 'x';
|
||||||
(void) puts("Options are:");
|
/* FALLTHROUGH */
|
||||||
(void) puts(" (e)dit sudoers file again");
|
case 'e':
|
||||||
(void) puts(" e(x)it without saving changes to sudoers file");
|
case 'x':
|
||||||
(void) puts(" (Q)uit and save changes to sudoers file (DANGER!)\n");
|
case 'Q':
|
||||||
|
return(choice);
|
||||||
|
default:
|
||||||
|
(void) puts("Options are:");
|
||||||
|
(void) puts(" (e)dit sudoers file again");
|
||||||
|
(void) puts(" e(x)it without saving changes to sudoers file");
|
||||||
|
(void) puts(" (Q)uit and save changes to sudoers file (DANGER!)\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(choice);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user