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

Signed-off-by: Juergen Gross <[email protected]>
---
V2:
- new patch
---
 tools/xs-clients/xenstore_client.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/xs-clients/xenstore_client.c 
b/tools/xs-clients/xenstore_client.c
index 3b02d3a196..29d840df84 100644
--- a/tools/xs-clients/xenstore_client.c
+++ b/tools/xs-clients/xenstore_client.c
@@ -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);
-- 
2.53.0


Reply via email to