firmware-utils/ptgen: fix partition guid and name
authorOskari Lemmela <oskari@lemmela.net>
Tue, 2 Mar 2021 19:42:07 +0000 (21:42 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Wed, 3 Mar 2021 01:00:23 +0000 (01:00 +0000)
guid and name function should be called before storing
partition info.

Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
tools/firmware-utils/src/ptgen.c

index a55f2e7a14c1863bdc7824b9b03912597ecf1978..d50c12b71432bd3ce9282af2f77ac1d1b4e7e919 100644 (file)
@@ -529,7 +529,8 @@ static guid_t type_to_guid_and_name(unsigned char type, char **name)
 
        switch (type) {
                case 0xef:
-                       *name = "EFI System Partition";
+                       if(*name == NULL)
+                               *name = "EFI System Partition";
                        guid = GUID_PARTITION_SYSTEM;
                        break;
                case 0x83:
@@ -586,6 +587,7 @@ int main (int argc, char **argv)
                                *(p++) = 0;
                                parts[part].start = to_kbytes(p);
                        }
+                       part_guid = type_to_guid_and_name(type, &name);
                        parts[part].size = to_kbytes(optarg);
                        parts[part].required = required;
                        parts[part].name = name;
@@ -598,7 +600,6 @@ int main (int argc, char **argv)
                         */
                        name = NULL;
                        required = 0;
-                       part_guid = type_to_guid_and_name(type, &name);
                        break;
                case 'N':
                        name = optarg;