2013-07-23 06:44:22 +02:00
|
|
|
From cf7f87688efab2712f41b47eaad32e75ec730653 Mon Sep 17 00:00:00 2001
|
2013-03-05 11:12:49 +01:00
|
|
|
From: Gary Ching-Pang Lin <glin@suse.com>
|
|
|
|
Date: Fri, 1 Mar 2013 18:04:06 +0800
|
|
|
|
Subject: [PATCH] Remove double-separators from the bootpath
|
|
|
|
|
|
|
|
---
|
2013-07-23 06:44:22 +02:00
|
|
|
shim.c | 27 ++++++++++++++++++++-------
|
2013-03-05 11:12:49 +01:00
|
|
|
1 file changed, 20 insertions(+), 7 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/shim.c b/shim.c
|
2013-07-23 06:44:22 +02:00
|
|
|
index 0622c72..806f065 100644
|
2013-03-05 11:12:49 +01:00
|
|
|
--- a/shim.c
|
|
|
|
+++ b/shim.c
|
2013-07-23 06:44:22 +02:00
|
|
|
@@ -969,7 +969,7 @@ static EFI_STATUS generate_path(EFI_LOADED_IMAGE *li, CHAR16 *ImagePath,
|
2013-03-05 11:12:49 +01:00
|
|
|
{
|
|
|
|
EFI_DEVICE_PATH *devpath;
|
|
|
|
EFI_HANDLE device;
|
|
|
|
- int i;
|
|
|
|
+ int i, j, last = -1;
|
|
|
|
unsigned int pathlen = 0;
|
|
|
|
EFI_STATUS efi_status = EFI_SUCCESS;
|
|
|
|
CHAR16 *bootpath;
|
2013-07-23 06:44:22 +02:00
|
|
|
@@ -989,14 +989,27 @@ static EFI_STATUS generate_path(EFI_LOADED_IMAGE *li, CHAR16 *ImagePath,
|
2013-03-05 11:12:49 +01:00
|
|
|
if (bootpath[i] == '/')
|
|
|
|
bootpath[i] = '\\';
|
|
|
|
}
|
|
|
|
+
|
|
|
|
for (i=pathlen; i>0; i--) {
|
|
|
|
- if (bootpath[i] == '\\' && bootpath[i-1] != '\\')
|
|
|
|
- break;
|
|
|
|
+ if (bootpath[i] == '\\' && bootpath[i-1] == '\\')
|
|
|
|
+ bootpath[i] = '/';
|
|
|
|
+ else if (last == -1 && bootpath[i] == '\\')
|
|
|
|
+ last = i;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (last == -1 && bootpath[0] == '\\')
|
|
|
|
+ last = 0;
|
|
|
|
+ bootpath[last+1] = '\0';
|
|
|
|
+
|
|
|
|
+ if (last > 0) {
|
|
|
|
+ for (i = 0, j = 0; bootpath[i] != '\0'; i++) {
|
|
|
|
+ if (bootpath[i] != '/') {
|
|
|
|
+ bootpath[j] = bootpath[i];
|
|
|
|
+ j++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ bootpath[j] = '\0';
|
|
|
|
}
|
|
|
|
- if (bootpath[i] == '\\')
|
|
|
|
- bootpath[i+1] = '\0';
|
|
|
|
- else
|
|
|
|
- bootpath[0] = '\0';
|
|
|
|
|
|
|
|
while (*ImagePath == '\\')
|
|
|
|
ImagePath++;
|
|
|
|
--
|
2013-07-23 06:44:22 +02:00
|
|
|
1.8.1.4
|
2013-03-05 11:12:49 +01:00
|
|
|
|