grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 7/7] cryptodisk: Improve handling of partition name in cryptom


From: Glenn Washburn
Subject: [PATCH v4 7/7] cryptodisk: Improve handling of partition name in cryptomount password prompt
Date: Sat, 4 Dec 2021 01:15:50 -0600

Call grub_partition_get_name unconditionally to initialize the part
variable. Then part will only be NULL when grub_partition_get_name errors.
Note that when source->partition is NULL, then grub_partition_get_name
returns an allocated empty string. So no comma or partition will be printed,
as desired.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 grub-core/disk/cryptodisk.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
index ad08240ff..d50b3033e 100644
--- a/grub-core/disk/cryptodisk.c
+++ b/grub-core/disk/cryptodisk.c
@@ -1026,11 +1026,10 @@ grub_cryptodisk_scan_device_real (const char *name,
       {
        /* Get the passphrase from the user, if no key data. */
        askpass = 1;
-       if (source->partition != NULL)
-         part = grub_partition_get_name (source->partition);
+       part = grub_partition_get_name (source->partition);
        grub_printf_ (N_("Enter passphrase for %s%s%s (%s): "), source->name,
                     source->partition != NULL ? "," : "",
-                    part != NULL ? part : "",
+                    part != NULL ? part : N_("UNKNOWN"),
                     dev->uuid);
        grub_free (part);
 
-- 
2.27.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]