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:
Lucas De Marchi 2016-11-02 16:02:57 -02:00
parent f6d475c1e6
commit 4936fd8623
1 changed files with 1 additions and 1 deletions

View File

@ -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",