From 767c8ea6ceee540e903e1ef24114024461c81fb8 Mon Sep 17 00:00:00 2001 From: wanggang26 Date: Fri, 27 Oct 2023 16:33:34 +0800 Subject: [PATCH] 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 --- system/uorb/uORB/uORB.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/uorb/uORB/uORB.c b/system/uorb/uORB/uORB.c index e8f3e6d95..20d6e1157 100644 --- a/system/uorb/uORB/uORB.c +++ b/system/uorb/uORB/uORB.c @@ -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;