1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-28 05:57:33 +03:00

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.
This commit is contained in:
Krzesimir Nowak 2023-11-15 17:39:10 +01:00 committed by Luca Boccassi
parent 298b218fc8
commit 59c8afbc89

View File

@ -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);