xen/control: short circuit xctrl_on_watch_event on spurious event

If there's no data to read from xenstore short-circuit
xctrl_on_watch_event to return early, there's no reason to continue
since the lack of data would prevent matching against any known event
type.

Sponsored by:	Citrix Systems R&D
MFC with:	r352925
MFC after:	1 week
This commit is contained in:
Roger Pau Monné 2020-05-28 08:20:16 +00:00
parent 3e7df58df2
commit 06592d60f0

View File

@ -360,7 +360,7 @@ xctrl_on_watch_event(struct xs_watch *watch, const char **vec, unsigned int len)
error = xs_read(XST_NIL, "control", "shutdown",
&result_len, (void **)&result);
if (error != 0)
if (error != 0 || result_len == 0)
return;
/* Acknowledge the request by writing back an empty string. */