uorb: enable O_CLOEXEC explicit

to avoid potential fd leak which means fork/vfork will duplicate fd
without O_CLOEXEC flag to the child process.

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
wanggang26 2023-10-27 16:33:34 +08:00 committed by Xiang Xiao
parent bae15dfd58
commit 767c8ea6ce

View File

@ -75,7 +75,7 @@ static int orb_advsub_open(FAR const struct orb_metadata *meta, int flags,
reginfo.nbuffer = queue_size;
reginfo.persist = !!(flags & SENSOR_PERSIST);
fd = open(ORB_USENSOR_PATH, O_WRONLY);
fd = open(ORB_USENSOR_PATH, O_WRONLY | O_CLOEXEC);
if (fd < 0)
{
return fd;