mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-25 18:55:24 +00:00
cgpt: do not show length of 1 for undefined partitions
If a partition isn't "defined", then don't declare its size as 1.
BUG=chromium:236941
TEST=`cbuildbot {x86,amd64,arm}-generic-full` pass
TEST=`cgpt show -i 100 -s chromiumos_image.bin` shows 0
BRANCH=none
Change-Id: I538546b6b37a9137958d6f926a58753cf52c946a
Reviewed-on: https://gerrit.chromium.org/gerrit/50074
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
committed by
ChromeBot
parent
48b26dff12
commit
98624d3744
@@ -232,9 +232,14 @@ int CgptShow(CgptShowParams *params) {
|
||||
case 'b':
|
||||
printf("%" PRId64 "\n", entry->starting_lba);
|
||||
break;
|
||||
case 's':
|
||||
printf("%" PRId64 "\n", entry->ending_lba - entry->starting_lba + 1);
|
||||
case 's': {
|
||||
uint64_t size = 0;
|
||||
// If these aren't actually defined, don't show anything
|
||||
if (entry->ending_lba || entry->starting_lba)
|
||||
size = entry->ending_lba - entry->starting_lba + 1;
|
||||
printf("%" PRId64 "\n", size);
|
||||
break;
|
||||
}
|
||||
case 't':
|
||||
GuidToStr(&entry->type, buf, sizeof(buf));
|
||||
printf("%s\n", buf);
|
||||
|
||||
Reference in New Issue
Block a user