AP_Gripper: add O_CLOEXEC in places missing it

By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
This commit is contained in:
Lucas De Marchi 2016-11-07 11:19:41 -02:00
parent 8cec2c188f
commit b7e5f56bd7

View File

@ -22,7 +22,7 @@ AP_Gripper_EPM::AP_Gripper_EPM(struct AP_Gripper::Backend_Config &_config) :
void AP_Gripper_EPM::init_gripper()
{
#ifdef UAVCAN_NODE_FILE
_uavcan_fd = ::open(UAVCAN_NODE_FILE, 0);
_uavcan_fd = ::open(UAVCAN_NODE_FILE, O_CLOEXEC);
// http://ardupilot.org/dev/docs/learning-ardupilot-uarts-and-the-console.html
::printf("EPM: UAVCAN fd %d\n", _uavcan_fd);
#endif