OSDN Git Service

libparted: fix big-endian bug in gpt_get_max_supported_partition_count
authorJim Meyering <meyering@redhat.com>
Thu, 8 Oct 2009 20:03:37 +0000 (22:03 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 8 Oct 2009 20:03:37 +0000 (22:03 +0200)
* libparted/labels/gpt.c (gpt_get_max_supported_partition_count):
Convert ->SizeOfPartitionEntry from little-endian to CPU endianness
here, too.  This is along the same lines as commit d6e9b3bb, but
with the difference that this code is not reachable via the
command-line interface.

libparted/labels/gpt.c

index b4549ef..3f4edf7 100644 (file)
@@ -1552,7 +1552,7 @@ gpt_get_max_supported_partition_count (const PedDisk *disk, int *max_n)
                return false;
 
        *max_n = (disk->dev->sector_size * (pth->FirstUsableLBA - 2)
-                 / pth->SizeOfPartitionEntry);
+                 / PED_LE32_TO_CPU (pth->SizeOfPartitionEntry));
        pth_free (pth);
        return true;
 }