ui/ncurses: Fix adding unnecessary leading slashes to paths
[petitboot] / 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);