From b7e5f56bd7bb36a008183bfc881bf308dc5881fa Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Mon, 7 Nov 2016 11:19:41 -0200 Subject: [PATCH] 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. --- libraries/AP_Gripper/AP_Gripper_EPM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_Gripper/AP_Gripper_EPM.cpp b/libraries/AP_Gripper/AP_Gripper_EPM.cpp index 3e8d5bb1d7..3f686d61a9 100644 --- a/libraries/AP_Gripper/AP_Gripper_EPM.cpp +++ b/libraries/AP_Gripper/AP_Gripper_EPM.cpp @@ -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