Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] boot-directdisk: avoid loop in MBR disk signature generation
@ 2013-10-02 10:47 Jonathan Liu
  0 siblings, 0 replies; only message in thread
From: Jonathan Liu @ 2013-10-02 10:47 UTC (permalink / raw)
  To: openembedded-core

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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-02 10:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02 10:47 [PATCH] boot-directdisk: avoid loop in MBR disk signature generation Jonathan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox