ac1e11a
diff -rup xen-3.1.0-testing.hg-rc7.orig/tools/xenfb/xenfb.c xen-3.1.0-testing.hg-rc7.new/tools/xenfb/xenfb.c
ac1e11a
--- xen-3.1.0-testing.hg-rc7.orig/tools/xenfb/xenfb.c	2007-05-17 17:38:22.000000000 -0400
ac1e11a
+++ xen-3.1.0-testing.hg-rc7.new/tools/xenfb/xenfb.c	2007-05-17 18:33:25.000000000 -0400
ac1e11a
@@ -318,6 +318,10 @@ static int xenfb_using_old_protocol(stru
ac1e11a
 
ac1e11a
 	for (;;) {
ac1e11a
 		state = xenfb_read_state(xsh, xenfb->fb.otherend);
ac1e11a
+		if (state == XenbusStateUnknown) {
ac1e11a
+			ret = -1;
ac1e11a
+			break;
ac1e11a
+		}
ac1e11a
 		if (state > XenbusStateInitialising) {
ac1e11a
 			ret = 0; /* frontend talks xenbus protocol */
ac1e11a
 			break;
ac1e11a
@@ -570,7 +574,7 @@ int xenfb_attach_dom(struct xenfb *xenfb
ac1e11a
 {
ac1e11a
 	struct xenfb_private *xenfb = (struct xenfb_private *)xenfb_pub;
ac1e11a
 	struct xs_handle *xsh = xenfb->xsh;
ac1e11a
-	int val, serrno;
ac1e11a
+	int ret, val, serrno;
ac1e11a
 	struct xenfb_page *fb_page;
ac1e11a
 
ac1e11a
 	xenfb_detach_dom(xenfb);
ac1e11a
@@ -600,8 +604,9 @@ int xenfb_attach_dom(struct xenfb *xenfb
ac1e11a
 	if (!xs_watch(xsh, xenfb->kbd.otherend, ""))
ac1e11a
 		goto error;
ac1e11a
 
ac1e11a
-	if (xenfb_using_old_protocol(xenfb))
ac1e11a
-		return 1;
ac1e11a
+	ret = xenfb_using_old_protocol(xenfb);
ac1e11a
+	if (ret)
ac1e11a
+		return ret;
ac1e11a
 
ac1e11a
 	if (xenfb_wait_for_frontend_initialised(&xenfb->fb) < 0)
ac1e11a
 		goto error;