summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-12-03 20:58:00 +0100
committerLennart Poettering <lennart@poettering.net>2020-12-04 17:50:18 +0100
commit62ea0ed08d0fba0bcf0a7fbde2d2ec1d317b66c7 (patch)
treefcfadc9dd1d9da8189ef05b1435d6f0f979722e0
parentsocket-util: make several socket_set_xxx() functions inline (diff)
downloadsystemd-62ea0ed08d0fba0bcf0a7fbde2d2ec1d317b66c7.tar.xz
systemd-62ea0ed08d0fba0bcf0a7fbde2d2ec1d317b66c7.zip
dissect: don't declare unused variables on archs that have no GPT discovery
Fixes: #17839
-rw-r--r--src/shared/dissect-image.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
index c2c46e1816..ea94881efa 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -460,8 +460,12 @@ int dissect_image(
DissectedImage **ret) {
#if HAVE_BLKID
- sd_id128_t root_uuid = SD_ID128_NULL, root_verity_uuid = SD_ID128_NULL,
- usr_uuid = SD_ID128_NULL, usr_verity_uuid = SD_ID128_NULL;
+#ifdef GPT_ROOT_NATIVE
+ sd_id128_t root_uuid = SD_ID128_NULL, root_verity_uuid = SD_ID128_NULL;
+#endif
+#ifdef GPT_USR_NATIVE
+ sd_id128_t usr_uuid = SD_ID128_NULL, usr_verity_uuid = SD_ID128_NULL;
+#endif
bool is_gpt, is_mbr, generic_rw, multiple_generic = false;
_cleanup_(sd_device_unrefp) sd_device *d = NULL;
_cleanup_(dissected_image_unrefp) DissectedImage *m = NULL;
@@ -504,13 +508,19 @@ int dissect_image(
/* If the verity data declares it's for the /usr partition, then search for that, in all
* other cases assume it's for the root partition. */
+#ifdef GPT_USR_NATIVE
if (verity->designator == PARTITION_USR) {
usr_uuid = fsuuid;
usr_verity_uuid = vuuid;
} else {
+#endif
+#ifdef GPT_ROOT_NATIVE
root_uuid = fsuuid;
root_verity_uuid = vuuid;
+#endif
+#ifdef GPT_USR_NATIVE
}
+#endif
}
if (fstat(fd, &st) < 0)