From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: [PATCH] Make xenstored EOF-safe Date: Tue, 27 Nov 2007 15:00:12 +0000 Message-ID: <20071127150012.GA17443@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org As bug 968 suggests, xenstored must properly handle EOF from clients. From: Pavel Kankovsky Signed-off-by: Samuel Thibault diff -r 6fd17d0dcbcd tools/xenstore/xenstored_core.c --- a/tools/xenstore/xenstored_core.c Tue Nov 27 12:49:16 2007 +0000 +++ b/tools/xenstore/xenstored_core.c Tue Nov 27 14:56:35 2007 +0000 @@ -1266,7 +1266,7 @@ static void handle_input(struct connecti if (in->inhdr) { bytes = conn->read(conn, in->hdr.raw + in->used, sizeof(in->hdr) - in->used); - if (bytes < 0) + if (bytes <= 0) goto bad_client; in->used += bytes; if (in->used != sizeof(in->hdr)) @@ -1288,7 +1288,7 @@ static void handle_input(struct connecti bytes = conn->read(conn, in->buffer + in->used, in->hdr.msg.len - in->used); - if (bytes < 0) + if (bytes <= 0) goto bad_client; in->used += bytes;