diff options
Diffstat (limited to 'src/sysupdate/sysupdate-partition.c')
-rw-r--r-- | src/sysupdate/sysupdate-partition.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/sysupdate/sysupdate-partition.c b/src/sysupdate/sysupdate-partition.c index fa46574fd6..33d0e584ba 100644 --- a/src/sysupdate/sysupdate-partition.c +++ b/src/sysupdate/sysupdate-partition.c @@ -111,6 +111,7 @@ int read_partition_info( struct fdisk_parttype *pt; uint64_t start, size, flags; sd_id128_t ptid, id; + GptPartitionType type; size_t partno; int r; @@ -178,6 +179,8 @@ int read_partition_info( if (!label_copy) return log_oom(); + type = gpt_partition_type_from_uuid(ptid); + *ret = (PartitionInfo) { .partno = partno, .start = start, @@ -187,9 +190,9 @@ int read_partition_info( .uuid = id, .label = TAKE_PTR(label_copy), .device = TAKE_PTR(device), - .no_auto = FLAGS_SET(flags, SD_GPT_FLAG_NO_AUTO) && gpt_partition_type_knows_no_auto(ptid), - .read_only = FLAGS_SET(flags, SD_GPT_FLAG_READ_ONLY) && gpt_partition_type_knows_read_only(ptid), - .growfs = FLAGS_SET(flags, SD_GPT_FLAG_GROWFS) && gpt_partition_type_knows_growfs(ptid), + .no_auto = FLAGS_SET(flags, SD_GPT_FLAG_NO_AUTO) && gpt_partition_type_knows_no_auto(type), + .read_only = FLAGS_SET(flags, SD_GPT_FLAG_READ_ONLY) && gpt_partition_type_knows_read_only(type), + .growfs = FLAGS_SET(flags, SD_GPT_FLAG_GROWFS) && gpt_partition_type_knows_growfs(type), }; return 1; /* found! */ @@ -269,6 +272,7 @@ int patch_partition( _cleanup_(fdisk_unref_partitionp) struct fdisk_partition *pa = NULL; _cleanup_(fdisk_unref_contextp) struct fdisk_context *c = NULL; bool tweak_no_auto, tweak_read_only, tweak_growfs; + GptPartitionType type; int r, fd; assert(device); @@ -313,16 +317,18 @@ int patch_partition( return log_error_errno(r, "Failed to update partition UUID: %m"); } + type = gpt_partition_type_from_uuid(info->type); + /* Tweak the read-only flag, but only if supported by the partition type */ tweak_no_auto = FLAGS_SET(change, PARTITION_NO_AUTO) && - gpt_partition_type_knows_no_auto(info->type); + gpt_partition_type_knows_no_auto(type); tweak_read_only = FLAGS_SET(change, PARTITION_READ_ONLY) && - gpt_partition_type_knows_read_only(info->type); + gpt_partition_type_knows_read_only(type); tweak_growfs = FLAGS_SET(change, PARTITION_GROWFS) && - gpt_partition_type_knows_growfs(info->type); + gpt_partition_type_knows_growfs(type); if (change & PARTITION_FLAGS) { uint64_t flags; |