From: Markus Armbruster Subject: [PATCH][PVFB][TOOLS] Terminate backend when frontend vanishes early Date: Thu, 01 Mar 2007 21:56:59 +0100 Message-ID: <87hct4vg10.fsf@pike.pond.sub.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: 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 Ensure the backend terminates when the frontend vanishes before the connection is established. This happens when the guest doesn't have the devices. Signed-off-by: Markus Armbruster --- Note: * Callers of xenfb_wait_for_state() already do the right thing when it returns XenbusStateUnknown. * xenfb_read_state() can't return negative values. The useless test is a leftover from an older version. diff -r 2d3ceb082114 tools/xenfb/xenfb.c --- a/tools/xenfb/xenfb.c Mon Feb 26 09:13:50 2007 +0000 +++ b/tools/xenfb/xenfb.c Thu Mar 01 20:57:38 2007 +0100 @@ -245,11 +246,10 @@ static int xenfb_wait_for_state(struct x unsigned state, dummy; char **vec; + awaited |= 1 << XenbusStateUnknown; + for (;;) { state = xenfb_read_state(xsh, dir); - if (state < 0) - return -1; - if ((1 << state) & awaited) return state;