Skip to contentSkip to conversation

Terminate backend when frontend vanishes early

PATCH New Markus Armbruster 1 participant 1 message Mar 1, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Terminate backend when frontend vanishes early

Ensure the backend terminates when the frontend vanishes before the connection is established. This happens when the guest doesn't have the devices.

---
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.

tools/xenfb/xenfb.c +2 -3
diff -r 2d3ceb082114 tools/xenfb/xenfb.c
@@ -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;