cryptodisk: Improve handling of partition name in cryptomount password prompt
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> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
ebdd82b00c
commit
de14c4b36d
@ -1021,11 +1021,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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user