From: Jonathan Liu <net147@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] boot-directdisk: avoid loop in MBR disk signature generation
Date: Wed, 2 Oct 2013 20:47:11 +1000 [thread overview]
Message-ID: <1380710831-10855-1-git-send-email-net147@gmail.com> (raw)
Instead of looping until the generated signature is non-zero, just
return 'ffffffff' if it's zero. This avoids an infinite loop if the
generated signature is always zero.
Signed-off-by: Jonathan Liu <net147@gmail.com>
---
meta/classes/boot-directdisk.bbclass | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 0f64b44..5535728 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -148,11 +148,12 @@ python do_bootdirectdisk() {
def generate_disk_signature():
import uuid
- while True:
- signature = str(uuid.uuid4())[:8]
+ signature = str(uuid.uuid4())[:8]
- if signature != '00000000':
- return signature
+ if signature != '00000000':
+ return signature
+ else:
+ return 'ffffffff'
def validate_disk_signature(d):
import re
--
1.8.4
reply other threads:[~2013-10-02 10:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1380710831-10855-1-git-send-email-net147@gmail.com \
--to=net147@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox