AP_HAL: 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-10-30 11:42:48 -02:00
parent 490841a814
commit 7968736b1c
2 changed files with 2 additions and 2 deletions

View File

@ -464,7 +464,7 @@ static uint64_t micros64(void)
int main(int argc, const char *argv[])
{
int fd = open(argv[1], O_RDONLY);
int fd = open(argv[1], O_RDONLY|O_CLOEXEC);
if (fd == -1) {
perror(argv[1]);
exit(1);

View File

@ -177,7 +177,7 @@ static uint64_t micros64(void)
int main(int argc, const char *argv[])
{
int fd = open(argv[1], O_RDONLY);
int fd = open(argv[1], O_RDONLY|O_CLOEXEC);
if (fd == -1) {
perror(argv[1]);
exit(1);