enable O_CLOEXEC explicitly to avoid fd leak
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
parent
b04da1892e
commit
f6d378e528
@ -569,7 +569,7 @@ static int optee_ioctl_cancel(FAR struct socket *psocket,
|
|||||||
static int
|
static int
|
||||||
optee_ioctl_shm_alloc(FAR struct tee_ioctl_shm_alloc_data *data)
|
optee_ioctl_shm_alloc(FAR struct tee_ioctl_shm_alloc_data *data)
|
||||||
{
|
{
|
||||||
int memfd = memfd_create(OPTEE_SERVER_PATH, O_CREAT);
|
int memfd = memfd_create(OPTEE_SERVER_PATH, O_CREAT | O_CLOEXEC);
|
||||||
|
|
||||||
if (memfd < 0)
|
if (memfd < 0)
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ int dns_bind(sa_family_t family)
|
|||||||
|
|
||||||
/* Create a new socket */
|
/* Create a new socket */
|
||||||
|
|
||||||
sd = socket(family, SOCK_DGRAM, 0);
|
sd = socket(family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
|
||||||
if (sd < 0)
|
if (sd < 0)
|
||||||
{
|
{
|
||||||
ret = -get_errno();
|
ret = -get_errno();
|
||||||
|
@ -685,7 +685,7 @@ static int tzload(FAR const char *name,
|
|||||||
goto oops;
|
goto oops;
|
||||||
}
|
}
|
||||||
|
|
||||||
fid = _NX_OPEN(name, O_RDONLY);
|
fid = _NX_OPEN(name, O_RDONLY | O_CLOEXEC);
|
||||||
if (fid < 0)
|
if (fid < 0)
|
||||||
{
|
{
|
||||||
goto oops;
|
goto oops;
|
||||||
|
Loading…
Reference in New Issue
Block a user