aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xenstored_domain.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-07-24 18:28:48 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-07-24 18:28:48 +0100
commit698543a3139d11d724d2b7b0622a7ea42051a696 (patch)
tree0aa2dbd1eb56627c5d7a060b8bb7701f3f378498 /tools/xenstore/xenstored_domain.c
parente313dc3ed8a13242ce9a9c5cb658d482c44a192e (diff)
downloadxen-698543a3139d11d724d2b7b0622a7ea42051a696.tar.gz
xen-698543a3139d11d724d2b7b0622a7ea42051a696.tar.bz2
xen-698543a3139d11d724d2b7b0622a7ea42051a696.zip
xenstore: Small cleanups and fixes.
1. readfd/writefd account for EINTR/EAGAIN errno returns. 2. Handle zero return from ->read() and ->write() handlers symmetrically. 3. Fix some indentation issues (use hard tabs). Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/xenstore/xenstored_domain.c')
-rw-r--r--tools/xenstore/xenstored_domain.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index c51e2c73b9..d166c0556e 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -76,7 +76,6 @@ struct domain
static LIST_HEAD(domains);
-/* FIXME: Mark connection as broken (close it?) when this happens. */
static bool check_indexes(XENSTORE_RING_IDX cons, XENSTORE_RING_IDX prod)
{
return ((prod - cons) <= XENSTORE_RING_SIZE);
@@ -102,7 +101,8 @@ static const void *get_input_chunk(XENSTORE_RING_IDX cons,
return buf + MASK_XENSTORE_IDX(cons);
}
-static int writechn(struct connection *conn, const void *data, unsigned int len)
+static int writechn(struct connection *conn,
+ const void *data, unsigned int len)
{
uint32_t avail;
void *dest;
@@ -113,6 +113,7 @@ static int writechn(struct connection *conn, const void *data, unsigned int len)
cons = intf->rsp_cons;
prod = intf->rsp_prod;
mb();
+
if (!check_indexes(cons, prod)) {
errno = EIO;
return -1;