xenbus_get_state(): fix handling of failure in retrieving state
When xenstore_read_u64() returns an error status, the existing code
was overwriting the value pointed to by `state` with a potentially
uninitialized variable.
@@ -702,6 +702,7 @@ status xenbus_get_state(buffer path, XenbusState *state)
status s = xenstore_read_u64(0, path, "state", &val);
if (!is_ok(s))
*state = XenbusStateUnknown;
+ else
*state = val;
return s;
}
