[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/2] xenstore: don't die on access-denied child nodes in 'xenstore ls'
Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx> --- tools/xenstore/xenstore_client.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c index 3ac214b..996ee64 100644 --- a/tools/xenstore/xenstore_client.c +++ b/tools/xenstore/xenstore_client.c @@ -134,8 +134,13 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms unsigned int num, len; e = xs_directory(h, XBT_NULL, path, &num); - if (e == NULL) + if (e == NULL) { + if(errno == EACCES && cur_depth) + /* Don't stop listing just because access was denied to a descendant */ + return; + err(1, "xs_directory (%s)", path); + } for (i = 0; i<num; i++) { char buf[MAX_STRLEN(unsigned int)+1]; @@ -172,7 +177,7 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms /* Print value */ if (val == NULL) { - printf(":\n"); + putchar(':'); } else { if (max_width < (linewid + len + TAG_LEN)) { @@ -192,12 +197,12 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms } } } - free(val); if (show_perms) { perms = xs_get_permissions(h, XBT_NULL, newpath, &nperms); if (perms == NULL) { - warn("\ncould not access permissions for %s", e[i]); + if (val != NULL) + warn("\ncould not access permissions for %s", e[i]); } else { int i; @@ -214,6 +219,8 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms putchar('\n'); + free(val); + do_ls(h, newpath, cur_depth+1, show_perms); } free(e); -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |