ui/ncurses: Fix adding unnecessary leading slashes to paths
diff mbox

Message ID 20170315050215.4322-1-sam@mendozajonas.com
State Accepted
Headers show

Commit Message

Samuel Mendoza-Jonas March 15, 2017, 5:02 a.m. UTC
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 ui/ncurses/nc-boot-editor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/ui/ncurses/nc-boot-editor.c b/ui/ncurses/nc-boot-editor.c
index 7fa1a42..8991095 100644
--- a/ui/ncurses/nc-boot-editor.c
+++ b/ui/ncurses/nc-boot-editor.c
@@ -162,7 +162,8 @@  static char *conditional_prefix(struct pb_boot_data *ctx,
 	sep = "";
 	if (!prefix)
 		prefix = "";
-	else if (prefix[strlen(prefix)] != '/')
+	else if ((prefix[strlen(prefix) - 1] != '/') &&
+				(value[0] != '/'))
 		sep = "/";
 
 	return talloc_asprintf(ctx, "%s%s%s", prefix, sep, value);