mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-04 05:40:37 +08:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user