1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix yes_no_prompt() error handling.

This commit is contained in:
Alasdair Kergon 2005-08-31 19:32:10 +00:00
parent b496a6b227
commit ae9c3f1664
2 changed files with 18 additions and 7 deletions

View File

@ -1,5 +1,7 @@
Version 2.01.15 -
=================================
Fix yes_no_prompt() error handling.
Add lvm.conf comment warning against multiple filter lines.
Tidy lvmconf.sh.
Add format1 dev_write debug messages.
Add clustered VG attribute to report.

View File

@ -350,21 +350,30 @@ int segtype_arg(struct cmd_context *cmd, struct arg *a)
char yes_no_prompt(const char *prompt, ...)
{
int c = 0;
int c = 0, ret = 0;
va_list ap;
while (c != 'y' && c != 'n') {
if (c == '\n' || c == 0) {
do {
if (c == '\n' || !c) {
va_start(ap, prompt);
vprintf(prompt, ap);
va_end(ap);
}
c = tolower(getchar());
}
while (getchar() != '\n') ;
if ((c = getchar()) == EOF) {
ret = 'n';
break;
}
return c;
c = tolower(c);
if ((c == 'y') || (c == 'n'))
ret = c;
} while (!ret || c != '\n');
if (c != '\n')
printf("\n");
return ret;
}
static void __alloc(int size)