[syslinux:elflink] com32/chain: use disk_guid for part_guid for 0th partition

syslinux-bot for Michal Soltys soltys at ziu.info
Sat Feb 16 01:48:11 PST 2013


Commit-ID:  d7c0b9740859eb9051582a260755d8cc20e7c995
Gitweb:     http://www.syslinux.org/commit/d7c0b9740859eb9051582a260755d8cc20e7c995
Author:     Michal Soltys <soltys at ziu.info>
AuthorDate: Thu, 14 Feb 2013 16:51:46 +0100
Committer:  Michal Soltys <soltys at ziu.info>
CommitDate: Thu, 14 Feb 2013 16:53:05 +0100

com32/chain: use disk_guid for part_guid for 0th partition

Initial position of each itarator is whole disk, so this actually
matches.

Signed-off-by: Michal Soltys <soltys at ziu.info>

---
 com32/chain/chain.c    | 10 +++-------
 com32/chain/partiter.c |  1 +
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/com32/chain/chain.c b/com32/chain/chain.c
index bb24955..85ec723 100644
--- a/com32/chain/chain.c
+++ b/com32/chain/chain.c
@@ -110,15 +110,11 @@ static int find_by_guid(const struct guid *gpt_guid,
 	    pi_del(&boot_part);
 	    continue;
 	}
-	/* Check for a matching GPT disk guid */
-	if (!memcmp(&boot_part->gpt.disk_guid, gpt_guid, sizeof(*gpt_guid))) {
-	    goto ok;
-	}
-	/* disk guid doesn't match, maybe partition guid will */
-	while (!pi_next(boot_part)) {
+	/* Check for a matching GPT disk/partition guid */
+	do {
 	    if (!memcmp(&boot_part->gpt.part_guid, gpt_guid, sizeof(*gpt_guid)))
 		goto ok;
-	}
+	} while (!pi_next(boot_part));
     }
     drive = -1;
 ok:
diff --git a/com32/chain/partiter.c b/com32/chain/partiter.c
index c928f35..7f98ecb 100644
--- a/com32/chain/partiter.c
+++ b/com32/chain/partiter.c
@@ -142,6 +142,7 @@ static int pi_gpt_ctor(struct part_iter *iter,
     iter->gpt.ulast = gpth->lba_last_usable;
 
     memcpy(&iter->gpt.disk_guid, &gpth->disk_guid, sizeof(struct guid));
+    memcpy(&iter->gpt.part_guid, &gpth->disk_guid, sizeof(struct guid));
 
     iter->type = typegpt;
     return 0;


More information about the Syslinux-commits mailing list