Files
Per Noergaard Christensen 38038f6a48 lib: use O_CLOEXEC flag when opening EtherCAT master device
This flag specifies that the file descriptor should be closed when an
exec function is invoked. When a file descriptor is allocated (as with
open or dup), O_CLOEXEC bit is initially cleared on the new file
descriptor, meaning that descriptor will survive into the new program
after exec. Setting O_CLOEXEC avoid this survival of the desciptor in
the new program. And setting it at open() time is the only race-free
way to avoid accidentally leaking the fd via other threads that
concurrently do fork()+exec() (or similar, e.g. posix_spawn).
2022-08-30 14:39:32 +02:00
..