From d5c696fd5bd9c39ffd0d99a4f7269e0b264091f6 Mon Sep 17 00:00:00 2001 From: Gabriel Valcazar Date: Tue, 1 Jun 2021 17:53:54 +0200 Subject: [PATCH] recovery-utils: only print open device warning when encrypting partitions Technically, partition unencryption is safe to do in open devices, although it implies that at least one partition has already been encrypted. If we aren't going to encrypt any partitions, there's no need to print the warning. Signed-off-by: Gabriel Valcazar --- .../recovery/recovery-utils/recovery-utils/lib/recovery.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c index 09ab86de6..debdcdc2c 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c @@ -846,7 +846,12 @@ int encrypt_partitions(char *to_encrypt, char *to_unencrypt, unsigned char force goto err; } - print_open_device_warning(); + /* + * Print warning on open devices only if we're encrypting at least + * one partition. + */ + if (enc_diff[0]) + print_open_device_warning(); /* * At this point, we know that we have at least one partition to