[PATCH] ui/ncurses: Fix adding unnecessary leading slashes to paths

Samuel Mendoza-Jonas sam at mendozajonas.com
Wed Mar 15 16:02:15 AEDT 2017


Signed-off-by: Samuel Mendoza-Jonas <sam at mendozajonas.com>
---
 ui/ncurses/nc-boot-editor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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);
-- 
2.12.0



More information about the Petitboot mailing list