]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Fix size round up/round down 29954/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 9 Nov 2023 11:10:53 +0000 (12:10 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 9 Nov 2023 11:10:53 +0000 (12:10 +0100)
Currently, we round minimum sizes up and maximum size down, whereas
it should be the opposite as the current approach means that if the
same size is used for min and max, the min size will end up bigger
than the max size after rounding.

src/partition/repart.c

index 01cfc46f1ce73c3e096be8d1995b773fa788a5fe..43f6f4c3af090bb7b97b5f1cb785f1029d9b7691 100644 (file)
@@ -1686,10 +1686,10 @@ static int partition_read_definition(Partition *p, const char *path, const char
                 { "Partition", "Priority",                 config_parse_int32,         0, &p->priority                },
                 { "Partition", "Weight",                   config_parse_weight,        0, &p->weight                  },
                 { "Partition", "PaddingWeight",            config_parse_weight,        0, &p->padding_weight          },
-                { "Partition", "SizeMinBytes",             config_parse_size4096,      1, &p->size_min                },
-                { "Partition", "SizeMaxBytes",             config_parse_size4096,     -1, &p->size_max                },
-                { "Partition", "PaddingMinBytes",          config_parse_size4096,      1, &p->padding_min             },
-                { "Partition", "PaddingMaxBytes",          config_parse_size4096,     -1, &p->padding_max             },
+                { "Partition", "SizeMinBytes",             config_parse_size4096,     -1, &p->size_min                },
+                { "Partition", "SizeMaxBytes",             config_parse_size4096,      1, &p->size_max                },
+                { "Partition", "PaddingMinBytes",          config_parse_size4096,     -1, &p->padding_min             },
+                { "Partition", "PaddingMaxBytes",          config_parse_size4096,      1, &p->padding_max             },
                 { "Partition", "FactoryReset",             config_parse_bool,          0, &p->factory_reset           },
                 { "Partition", "CopyBlocks",               config_parse_copy_blocks,   0, p                           },
                 { "Partition", "Format",                   config_parse_fstype,        0, &p->format                  },