mirror of https://github.com/ArduPilot/ardupilot
AP_Terrain: 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:
parent
f6d475c1e6
commit
4936fd8623
|
@ -186,7 +186,7 @@ void AP_Terrain::open_file(void)
|
|||
if (fd != -1) {
|
||||
::close(fd);
|
||||
}
|
||||
fd = ::open(file_path, O_RDWR|O_CREAT, 0644);
|
||||
fd = ::open(file_path, O_RDWR|O_CREAT|O_CLOEXEC, 0644);
|
||||
if (fd == -1) {
|
||||
#if TERRAIN_DEBUG
|
||||
hal.console->printf("Open %s failed - %s\n",
|
||||
|
|
Loading…
Reference in New Issue