fdisk: avoid overflow in "mega/gigabytes" calculation, code shrink

function                                             old     new   delta
list_disk_geometry                                   175     145     -30

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2019-10-04 16:45:04 +02:00
parent 65741d004e
commit d8e4ce0503
4 changed files with 29 additions and 34 deletions

View File

@@ -470,7 +470,7 @@ xbsd_new_part(void)
end = xbsd_dlabel.d_secperunit - 1;
#endif
snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR));
snprintf(mesg, sizeof(mesg), "First %s", str_units());
begin = read_int(bsd_cround(begin), bsd_cround(begin), bsd_cround(end),
0, mesg);
@@ -478,7 +478,7 @@ xbsd_new_part(void)
begin = (begin - 1) * xbsd_dlabel.d_secpercyl;
snprintf(mesg, sizeof(mesg), "Last %s or +size or +sizeM or +sizeK",
str_units(SINGULAR));
str_units());
end = read_int(bsd_cround(begin), bsd_cround(end), bsd_cround(end),
bsd_cround(begin), mesg);