mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
enable O_CLOEXEC explicit
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user