Patch from Kent Robotti updating fdisk to version v2.11z

This commit is contained in:
Eric Andersen 2003-07-03 10:02:32 +00:00
parent e5920a2dc0
commit c48d49ad98

View File

@ -19,7 +19,7 @@
* Vladimir Oleynik <dzo@simtreas.ru> 2001,2002 Busybox port
*/
#define UTIL_LINUX_VERSION "2.11w"
#define UTIL_LINUX_VERSION "2.11z"
#define PROC_PARTITIONS "/proc/partitions"
@ -4317,11 +4317,14 @@ read_int(uint low, uint dflt, uint high, uint base, char *mesg)
continue;
if (*line_ptr == '+' || *line_ptr == '-') {
int minus = (*line_ptr == '-');
int absolute = 0;
i = atoi(line_ptr+1);
if (*line_ptr == '-')
i = -i;
while (isdigit(*++line_ptr))
use_default = 0;
switch (*line_ptr) {
case 'c':
case 'C':
@ -4330,25 +4333,31 @@ read_int(uint low, uint dflt, uint high, uint base, char *mesg)
break;
case 'k':
case 'K':
i *= 2;
i /= (sector_size / 512);
i /= units_per_sector;
absolute = 1000;
break;
case 'm':
case 'M':
i *= 2048;
i /= (sector_size / 512);
i /= units_per_sector;
absolute = 1000000;
break;
case 'g':
case 'G':
i *= 2048000;
i /= (sector_size / 512);
i /= units_per_sector;
absolute = 1000000000;
break;
default:
break;
}
if (absolute) {
unsigned long long bytes;
unsigned long unit;
bytes = (unsigned long long) i * absolute;
unit = sector_size * units_per_sector;
bytes += unit/2; /* round */
bytes /= unit;
i = bytes;
}
if (minus)
i = -i;
i += base;
} else {
i = atoi(line_ptr);
@ -4701,7 +4710,7 @@ static void check_consistency(const struct partition *p, int partition) {
/* Ending on cylinder boundary? */
if (peh != (heads - 1) || pes != sectors) {
printf(_("Partition %i does not end on cylinder boundary:\n"),
printf(_("Partition %i does not end on cylinder boundary.\n"),
partition + 1);
#if 0
printf(_(" phys=(%d, %d, %d) "), pec, peh, pes);
@ -5266,13 +5275,14 @@ new_partition(void) {
}
#endif
if (partitions >= MAXIMUM_PARTS) {
for (i = 0; i < 4; i++)
free_primary += !ptes[i].part_table->sys_ind;
if (!free_primary && partitions >= MAXIMUM_PARTS) {
printf(_("The maximum number of partitions has been created\n"));
return;
}
for (i = 0; i < 4; i++)
free_primary += !ptes[i].part_table->sys_ind;
if (!free_primary) {
if (extended_offset)
add_logical();