diff --git a/lib/common.c b/lib/common.c index 88bcabe5..86a38586 100644 --- a/lib/common.c +++ b/lib/common.c @@ -97,9 +97,9 @@ ec_master_t *ecrt_open_master(unsigned int master_index) master_index); #ifdef USE_RTDM - master->fd = rt_dev_open(path, O_RDWR); + master->fd = rt_dev_open(path, O_RDWR | O_CLOEXEC); #else - master->fd = open(path, O_RDWR); + master->fd = open(path, O_RDWR | O_CLOEXEC); #endif if (EC_IOCTL_IS_ERROR(master->fd)) { EC_PRINT_ERR("Failed to open %s: %s\n", path,