grub2/0067-grub-core-disk-cryptodisk.c-grub_cmd_cryptomount-Str.patch
Peter Jones f74b50e380 Rebase to upstream, fix a pile of bugs. The usual.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-06-12 15:37:08 -04:00

55 lines
1.6 KiB
Diff

From dc089e5e9c9bf5ba1fa00cf8166f9628804741d9 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 10 Dec 2012 19:15:51 +0100
Subject: [PATCH 067/482] * grub-core/disk/cryptodisk.c
(grub_cmd_cryptomount): Strip brackets around device name if
necessarry.
---
ChangeLog | 5 +++++
grub-core/disk/cryptodisk.c | 12 +++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index e522078..8d7d988 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/disk/cryptodisk.c (grub_cmd_cryptomount): Strip brackets
+ around device name if necessarry.
+
2012-12-10 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
* util/grub-install.in: Follow the symbolic link parameter added
diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
index 1ac906d..3de3b86 100644
--- a/grub-core/disk/cryptodisk.c
+++ b/grub-core/disk/cryptodisk.c
@@ -928,10 +928,20 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args)
grub_err_t err;
grub_disk_t disk;
grub_cryptodisk_t dev;
+ char *devname;
+ char *devlast;
search_uuid = NULL;
check_boot = state[2].set;
- disk = grub_disk_open (args[0]);
+ devname = args[0];
+ if (devname[0] == '(' && *(devlast = &devname[grub_strlen (devname) - 1]) == ')')
+ {
+ *devlast = '\0';
+ disk = grub_disk_open (devname + 1);
+ *devlast = ')';
+ }
+ else
+ disk = grub_disk_open (devname);
if (!disk)
return grub_errno;
--
1.8.2.1