grub2/0066-grub-core-disk-cryptodisk.c-grub_cmd_cryptomount-Str.patch
2013-05-02 16:54:52 -04:00

54 lines
1.6 KiB
Diff

From 08a1459a9534fa2337744a32dda511d496e9d6cf 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 066/364] * 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.1.4