ui/ncurses: Fix adding unnecessary leading slashes to paths
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 20 Feb 2017 05:24:47 +0000 (16:24 +1100)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Wed, 15 Mar 2017 05:29:57 +0000 (16:29 +1100)
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
ui/ncurses/nc-boot-editor.c

index 7fa1a42f0eddfbc07794b9f003c4dbfd330dfac6..89910951db610d311501337dfd45d001d56fd1ad 100644 (file)
@@ -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);