Browse Source

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.
mission-4.1.18
Lucas De Marchi 8 years ago
parent
commit
b7e5f56bd7
  1. 2
      libraries/AP_Gripper/AP_Gripper_EPM.cpp

2
libraries/AP_Gripper/AP_Gripper_EPM.cpp

@ -22,7 +22,7 @@ AP_Gripper_EPM::AP_Gripper_EPM(struct AP_Gripper::Backend_Config &_config) : @@ -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

Loading…
Cancel
Save