[parted-devel] FYI, one more use of SizeOfPartitionEntry

Jim Meyering jim at meyering.net
Tue Oct 6 19:50:07 UTC 2009


Officially, there is one more use of the SizeOfPartitionEntry
member that must be converted from LE32 to CPU endianness.
However, that use is in a function that is no longer called
via the parted command-line tool.

It's still in the library, so I'll fix it right away,
in case some library client uses this new-in-1.9.0 function:

diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index b4549ef..3f4edf7 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -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;
 }



More information about the parted-devel mailing list