mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-20 06:43:56 -04:00
Tools: 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
4936fd8623
commit
8cec2c188f
@ -71,7 +71,7 @@ int main (void)
|
||||
uint32_t *iram;
|
||||
uint32_t *ctrl;
|
||||
|
||||
mem_fd = open("/dev/mem", O_RDWR|O_SYNC);
|
||||
mem_fd = open("/dev/mem", O_RDWR|O_SYNC|O_CLOEXEC);
|
||||
|
||||
ring_buffer = (struct ring_buffer*) mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, RCIN_PRUSS_RAM_BASE);
|
||||
pwm = (struct pwm*) mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, RCOUT_PRUSS_RAM_BASE);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
bool DataFlashFileReader::open_log(const char *logfile)
|
||||
{
|
||||
fd = ::open(logfile, O_RDONLY);
|
||||
fd = ::open(logfile, O_RDONLY|O_CLOEXEC);
|
||||
if (fd == -1) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user