enable O_CLOEXEC explicit

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
wanggang26
2023-09-13 21:08:13 +08:00
committed by Xiang Xiao
parent 2d817deecb
commit e930476b4b
25 changed files with 41 additions and 35 deletions
+3 -2
View File
@@ -239,7 +239,7 @@ static int local_rx_open(FAR struct local_conn_s *conn, FAR const char *path,
int oflags = nonblock ? O_RDONLY | O_NONBLOCK : O_RDONLY;
int ret;
ret = file_open(&conn->lc_infile, path, oflags);
ret = file_open(&conn->lc_infile, path, oflags | O_CLOEXEC);
if (ret < 0)
{
nerr("ERROR: Failed on open %s for reading: %d\n",
@@ -272,7 +272,8 @@ static int local_tx_open(FAR struct local_conn_s *conn, FAR const char *path,
{
int ret;
ret = file_open(&conn->lc_outfile, path, O_WRONLY | O_NONBLOCK);
ret = file_open(&conn->lc_outfile, path, O_WRONLY | O_NONBLOCK |
O_CLOEXEC);
if (ret < 0)
{
nerr("ERROR: Failed on open %s for writing: %d\n",
+1 -1
View File
@@ -361,7 +361,7 @@ int snoop_open(FAR struct snoop_s *snoop, FAR const char *filename,
}
}
ret = file_open(&snoop->filep, filename, O_RDWR | O_CREAT);
ret = file_open(&snoop->filep, filename, O_RDWR | O_CREAT | O_CLOEXEC);
if (ret < 0)
{
return ret;