rendered paste body--- a/tools/xenfb/xenfb.c 2007-02-27 18:39:54.000000000 +0100
+++ b/tools/xenfb/xenfb.c 2007-03-02 15:06:07.000000000 +0100
@@ -243,6 +243,8 @@ 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)
@@ -317,6 +319,10 @@ static int xenfb_using_old_protocol(stru
for (;;) {
state = xenfb_read_state(xsh, xenfb->fb.otherend);
+ if (state == XenbusStateUnknown) {
+ ret = -1;
+ break;
+ }
if (state > XenbusStateInitialising) {
ret = 0; /* frontend talks xenbus protocol */
break;
@@ -534,7 +540,7 @@ int xenfb_attach_dom(struct xenfb *xenfb
{
struct xenfb_private *xenfb = (struct xenfb_private *)xenfb_pub;
struct xs_handle *xsh = xenfb->xsh;
- int val, serrno;
+ int ret, val, serrno;
struct xenfb_page *fb_page;
xenfb_detach_dom(xenfb);
@@ -564,8 +570,9 @@ int xenfb_attach_dom(struct xenfb *xenfb
if (!xs_watch(xsh, xenfb->kbd.otherend, ""))
goto error;
- if (xenfb_using_old_protocol(xenfb))
- return 1;
+ ret = xenfb_using_old_protocol(xenfb);
+ if (ret)
+ return ret;
if (xenfb_wait_for_frontend_initialised(&xenfb->fb) < 0)
goto error;