This should reduce the chance of generating 0xffffffff as the disk
system identifier.
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
import logging
import os
+import random
import shutil
import tempfile
import uuid
# all partitions (in bytes)
self.ptable_format = ptable_format # Partition table format
# Disk system identifier
- self.identifier = int.from_bytes(os.urandom(4), 'little') or 0xffffffff
+ self.identifier = random.SystemRandom().randint(1, 0xffffffff)
self.partitions = partitions
self.partimages = []