From: Krzesimir Nowak Date: Wed, 15 Nov 2023 16:39:10 +0000 (+0100) Subject: repart: Fix compilation warning when tpm2 is disabled X-Git-Tag: v255-rc3~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59c8afbc89608af2212ad1a5e06d8536b595eeed;p=thirdparty%2Fsystemd.git repart: Fix compilation warning when tpm2 is disabled The warning is about unused variable "flags": ``` ../src/partition/repart.c: In function ‘partition_encrypt’: ../src/partition/repart.c:3690:19: warning: unused variable ‘flags’ [-Wunused-variable] 3690 | TPM2Flags flags = 0; | ^~~~~ ``` Move the flags variable into the scope where it is actually used, which happens to be inside the HAVE_TPM2 block. --- diff --git a/src/partition/repart.c b/src/partition/repart.c index 88d4c5186db..654b931c192 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -3687,7 +3687,6 @@ static int partition_encrypt(Context *context, Partition *p, PartitionTarget *ta _cleanup_free_ char *hp = NULL, *vol = NULL, *dm_name = NULL; const char *passphrase = NULL; size_t passphrase_size = 0; - TPM2Flags flags = 0; const char *vt; int r; @@ -3782,6 +3781,7 @@ static int partition_encrypt(Context *context, Partition *p, PartitionTarget *ta size_t secret_size, blob_size, pubkey_size = 0, srk_buf_size = 0; ssize_t base64_encoded_size; int keyslot; + TPM2Flags flags = 0; if (arg_tpm2_public_key_pcr_mask != 0) { r = tpm2_load_pcr_public_key(arg_tpm2_public_key, &pubkey, &pubkey_size);