diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-10-25 17:32:01 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-11-29 16:05:17 +0100 |
commit | e3b9a5ff26a2363c523cfbc4ae0eb7e09f6ce68d (patch) | |
tree | e75ab7a8846d880db17f7f756578fbe541baf07e /src/home | |
parent | 04613753260cf1df47c6c1fbed9b02efd4f8af48 (diff) | |
download | systemd-e3b9a5ff26a2363c523cfbc4ae0eb7e09f6ce68d.tar.gz |
blkid: add helpers that get gpt partition uuid as sd_id128_t
just some refactoring to make things simpler.
Diffstat (limited to 'src/home')
-rw-r--r-- | src/home/homework-luks.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index 48e8cd1808..3d3369f299 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -695,9 +695,8 @@ static int luks_validate( return errno > 0 ? -errno : -EIO; for (int i = 0; i < n; i++) { - blkid_partition pp; sd_id128_t id = SD_ID128_NULL; - const char *sid; + blkid_partition pp; errno = 0; pp = blkid_partlist_get_partition(pl, i); @@ -710,15 +709,12 @@ static int luks_validate( if (!streq_ptr(blkid_partition_get_name(pp), label)) continue; - sid = blkid_partition_get_uuid(pp); - if (sid) { - r = sd_id128_from_string(sid, &id); - if (r < 0) - log_debug_errno(r, "Couldn't parse partition UUID %s, weird: %m", sid); - if (!sd_id128_is_null(partition_uuid) && !sd_id128_equal(id, partition_uuid)) - continue; - } + r = blkid_partition_get_uuid_id128(pp, &id); + if (r < 0) + log_debug_errno(r, "Failed to read partition UUID, ignoring: %m"); + else if (!sd_id128_is_null(partition_uuid) && !sd_id128_equal(id, partition_uuid)) + continue; if (found) return -ENOPKG; |