mirror of
https://github.com/apache/nuttx.git
synced 2026-09-27 18:58:27 +08:00
enable O_CLOEXEC explicit
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
@@ -749,7 +749,7 @@ FAR struct mtd_dev_s *filemtd_initialize(FAR const char *path, size_t offset,
|
||||
|
||||
/* Set the file open mode. */
|
||||
|
||||
mode = O_RDOK | O_WROK;
|
||||
mode = O_RDOK | O_WROK | O_CLOEXEC;
|
||||
|
||||
/* Try to open the file. NOTE that block devices will use a character
|
||||
* driver proxy.
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <poll.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
@@ -1801,7 +1802,7 @@ int mtdconfig_unregister(void)
|
||||
FAR struct inode *inode;
|
||||
FAR struct mtdconfig_struct_s *dev;
|
||||
|
||||
ret = file_open(&file, "/dev/config", 0);
|
||||
ret = file_open(&file, "/dev/config", O_CLOEXEC);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: open /dev/config failed: %d\n", ret);
|
||||
|
||||
@@ -2081,7 +2081,7 @@ int mtdconfig_unregister_by_path(FAR const char *path)
|
||||
FAR struct inode *inode;
|
||||
FAR struct nvs_fs *fs;
|
||||
|
||||
ret = file_open(&file, path, 0);
|
||||
ret = file_open(&file, path, O_CLOEXEC);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: open file %s err: %d\n", path, ret);
|
||||
|
||||
Reference in New Issue
Block a user