summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2013-05-03 18:05:16 -0400
committerChromeBot <chrome-bot@google.com>2013-06-24 13:08:12 -0700
commit98624d37447d01a9a78d9e0a1f55cbbce2ee99e4 (patch)
treed8eb7422bea28cdb38c9c256676a47b4e6834098
parent48b26dff12fdbf37f1effc358aa7e77ba13736ff (diff)
downloadvboot-98624d37447d01a9a78d9e0a1f55cbbce2ee99e4.tar.gz
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>
-rw-r--r--cgpt/cgpt_show.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cgpt/cgpt_show.c b/cgpt/cgpt_show.c
index 351c9cef..e80567c3 100644
--- a/cgpt/cgpt_show.c
+++ b/cgpt/cgpt_show.c
@@ -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);