Make sure metadata and free space are updated after reading the partition table. Else non-standard metadata length for an empty GPT table may be incorrectly reported until a change is performed.
Fixes: #79720 Signed-off-by: Pascal Hambourg <[email protected]> --- libparted/disk.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libparted/disk.c b/libparted/disk.c index 0db7b5c9..35148100 100644 --- a/libparted/disk.c +++ b/libparted/disk.c @@ -200,6 +200,11 @@ ped_disk_new (PedDevice* dev) goto error_close_dev; if (!type->ops->read (disk)) goto error_destroy_disk; + /* Kludge to make sure metadata are updated after read */ + if (!_disk_push_update_mode (disk)) + goto error_destroy_disk; + if (!_disk_pop_update_mode (disk)) + goto error_destroy_disk; disk->needs_clobber = 0; ped_device_close (dev); return disk; -- 2.39.5
