fdisk: quit from partition type dialog after invalid response
This gets rid of the while() loop and fixes indentation. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
This commit is contained in:
parent
37b4484fe6
commit
b25c9df7c7
|
@ -2534,8 +2534,7 @@ new_partition(void) {
|
||||||
} else {
|
} else {
|
||||||
char c, dflt, line[LINE_LENGTH];
|
char c, dflt, line[LINE_LENGTH];
|
||||||
|
|
||||||
while (1) {
|
dflt = (free_primary == 1 && !extended_offset) ? 'e' : 'p';
|
||||||
dflt = (free_primary == 1 && !extended_offset) ? 'e' : 'p';
|
|
||||||
snprintf(line, sizeof(line),
|
snprintf(line, sizeof(line),
|
||||||
_("Partition type:\n"
|
_("Partition type:\n"
|
||||||
" p primary (%d primary, %d extended, %d free)\n"
|
" p primary (%d primary, %d extended, %d free)\n"
|
||||||
|
@ -2545,30 +2544,26 @@ new_partition(void) {
|
||||||
extended_offset ? _(" l logical (numbered from 5)") : _(" e extended"),
|
extended_offset ? _(" l logical (numbered from 5)") : _(" e extended"),
|
||||||
dflt);
|
dflt);
|
||||||
|
|
||||||
c = tolower(read_chars(line));
|
c = tolower(read_chars(line));
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
c = dflt;
|
c = dflt;
|
||||||
printf(_("Using default response %c\n"), c);
|
printf(_("Using default response %c\n"), c);
|
||||||
}
|
|
||||||
if (c == 'p') {
|
|
||||||
int i = get_nonexisting_partition(0, 4);
|
|
||||||
if (i >= 0)
|
|
||||||
add_partition(i, LINUX_NATIVE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (c == 'l' && extended_offset) {
|
|
||||||
add_logical();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (c == 'e' && !extended_offset) {
|
|
||||||
int i = get_nonexisting_partition(0, 4);
|
|
||||||
if (i >= 0)
|
|
||||||
add_partition(i, EXTENDED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf(_("Invalid partition type `%c'\n"), c);
|
|
||||||
}
|
}
|
||||||
|
if (c == 'p') {
|
||||||
|
int i = get_nonexisting_partition(0, 4);
|
||||||
|
if (i >= 0)
|
||||||
|
add_partition(i, LINUX_NATIVE);
|
||||||
|
return;
|
||||||
|
} else if (c == 'l' && extended_offset) {
|
||||||
|
add_logical();
|
||||||
|
return;
|
||||||
|
} else if (c == 'e' && !extended_offset) {
|
||||||
|
int i = get_nonexisting_partition(0, 4);
|
||||||
|
if (i >= 0)
|
||||||
|
add_partition(i, EXTENDED);
|
||||||
|
return;
|
||||||
|
} else
|
||||||
|
printf(_("Invalid partition type `%c'\n"), c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue