enable O_CLOEXEC explicitly to avoid fd leak

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
wanggang26
2024-02-28 15:45:18 +08:00
committed by Xiang Xiao
parent b04da1892e
commit f6d378e528
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ int dns_bind(sa_family_t family)
/* Create a new socket */
sd = socket(family, SOCK_DGRAM, 0);
sd = socket(family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (sd < 0)
{
ret = -get_errno();
+1 -1
View File
@@ -685,7 +685,7 @@ static int tzload(FAR const char *name,
goto oops;
}
fid = _NX_OPEN(name, O_RDONLY);
fid = _NX_OPEN(name, O_RDONLY | O_CLOEXEC);
if (fid < 0)
{
goto oops;