[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xenstore: xenbus cannot be opened read-only
# HG changeset patch # User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> # Date 1321981652 0 # Node ID 8edcd2e3f3f1751d3e85b7612d1fa72c8d071047 # Parent b21b6c91c1f4f44523c0d401100a8cd9498fa514 xenstore: xenbus cannot be opened read-only In order to read keys from xenstore, the xenstore libraries need to write the request to the xenbus socket. This means that the socket cannot be opened read-only. Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- diff -r b21b6c91c1f4 -r 8edcd2e3f3f1 tools/xenstore/xs.c --- a/tools/xenstore/xs.c Tue Nov 22 16:19:48 2011 +0000 +++ b/tools/xenstore/xs.c Tue Nov 22 17:07:32 2011 +0000 @@ -182,15 +182,13 @@ return -1; } -static int get_dev(const char *connect_to, unsigned long flags) +static int get_dev(const char *connect_to) { - if (flags & XS_OPEN_READONLY) - return open(connect_to, O_RDONLY); - else - return open(connect_to, O_RDWR); + /* We cannot open read-only because requests are writes */ + return open(connect_to, O_RDWR); } -static struct xs_handle *get_handle(const char *connect_to, unsigned long flags) +static struct xs_handle *get_handle(const char *connect_to) { struct stat buf; struct xs_handle *h = NULL; @@ -202,7 +200,7 @@ if (S_ISSOCK(buf.st_mode)) fd = get_socket(connect_to); else - fd = get_dev(connect_to, flags); + fd = get_dev(connect_to); if (fd == -1) return NULL; @@ -258,12 +256,12 @@ struct xs_handle *xsh = NULL; if (flags & XS_OPEN_READONLY) - xsh = get_handle(xs_daemon_socket_ro(), flags); + xsh = get_handle(xs_daemon_socket_ro()); else - xsh = get_handle(xs_daemon_socket(), flags); + xsh = get_handle(xs_daemon_socket()); if (!xsh && !(flags & XS_OPEN_SOCKETONLY)) - xsh = get_handle(xs_domain_dev(), flags); + xsh = get_handle(xs_domain_dev()); return xsh; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |