From 6d6366df48eb016389e814a3194de781e9268c54 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 29 Jun 2018 13:38:08 +1000 Subject: [PATCH] SITL: Sim_Vicon: set CLOEXEC on vicon file decsriptor --- libraries/SITL/SIM_Vicon.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/SITL/SIM_Vicon.cpp b/libraries/SITL/SIM_Vicon.cpp index da2cb92c62..f1b58d413c 100644 --- a/libraries/SITL/SIM_Vicon.cpp +++ b/libraries/SITL/SIM_Vicon.cpp @@ -35,6 +35,10 @@ Vicon::Vicon() fd_my_end = tmp[1]; fd_their_end = tmp[0]; + // close file descriptors on exec: + fcntl(fd_my_end, F_SETFD, FD_CLOEXEC); + fcntl(fd_their_end, F_SETFD, FD_CLOEXEC); + // make sure we don't screw the simulation up by blocking: fcntl(fd_my_end, F_SETFL, fcntl(fd_my_end, F_GETFL, 0) | O_NONBLOCK); fcntl(fd_their_end, F_SETFL, fcntl(fd_their_end, F_GETFL, 0) | O_NONBLOCK);