WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Make xenstored EOF-safe

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Make xenstored EOF-safe
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Tue, 27 Nov 2007 15:00:12 +0000
Delivery-date: Tue, 27 Nov 2007 07:00:58 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
As bug 968 suggests, xenstored must properly handle EOF from clients.

From: Pavel Kankovsky <peak@xxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxx>

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;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>