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:
parent
490841a814
commit
7968736b1c
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user