tools/xs-clients: fix output of "xenstore-list -p /"

When calling "xenstore-list -p /" it will prepend all listed keys
with "//" instead of "/".

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Juergen Gross authored and Andrew Cooper committed 2026-03-13 17:18:04 +00:00
1 parent a772a005ed
commit a3a3e7bdd7
1 file changed
+5 -1
+5 -1
View File
@@ -568,13 +568,17 @@ perform(enum mode mode, int optind, int argc, char **argv, struct xs_handle *xsh
case MODE_list: {
unsigned int i, num;
char **list = xs_directory(xsh, xth, argv[optind], &num);
const char *pref = argv[optind];
if (list == NULL) {
warnx("could not list path %s", argv[optind]);
return 1;
}
if (prefix && !strcmp(pref, "/"))
pref = "";
for (i = 0; i < num; i++) {
if (prefix)
output("%s/", argv[optind]);
output("%s/", pref);
output("%s\n", list[i]);
}
free(list);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.