uORBManager: Make orb_check fail safely

The `orb_check` function takes a pointer to a `bool` which it then passes
to `px4_ioctl`. However, if the call to `px4_ioctl` fails, the bool
doesn't get updated (neither set nor cleared). Therefore, in `orb_check`
we explicitly set the bool to `false` before passing the pointer to
`px4_ioctl`.
This commit is contained in:
Erik de Castro Lopo
2015-11-26 12:18:42 +11:00
parent 5e9a8d0c03
commit 4f7ab6f4f3
+2
View File
@@ -164,6 +164,8 @@ int uORB::Manager::orb_copy(const struct orb_metadata *meta, int handle, void *b
int uORB::Manager::orb_check(int handle, bool *updated)
{
/* Set to false here so that if `px4_ioctl` fails to false. */
*updated = false;
return px4_ioctl(handle, ORBIOCUPDATED, (unsigned long)(uintptr_t)updated);
}