refine: set file mode when oflags contains O_CREAT

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
wanggang26 2023-09-21 22:16:40 +08:00 committed by Xiang Xiao
parent 582e0ab51f
commit d827ee5ffc
2 changed files with 6 additions and 3 deletions

View File

@ -446,8 +446,10 @@ int cxd56_src_init(struct cxd56_dev_s *dev,
#ifdef DUMP_DATA
nx_unlink(dump_name_pre);
nx_unlink(dump_name_post);
file_open(&dump_file_pre, dump_name_pre, O_WRONLY | O_CREAT | O_APPEND);
file_open(&dump_file_post, dump_name_post, O_WRONLY | O_CREAT | O_APPEND);
file_open(&dump_file_pre, dump_name_pre, O_WRONLY | O_CREAT | O_APPEND,
0666);
file_open(&dump_file_post, dump_name_post, O_WRONLY | O_CREAT | O_APPEND,
0666);
#endif
/* Join any old worker threads to prevent memory leaks */

View File

@ -361,7 +361,8 @@ int snoop_open(FAR struct snoop_s *snoop, FAR const char *filename,
}
}
ret = file_open(&snoop->filep, filename, O_RDWR | O_CREAT | O_CLOEXEC);
ret = file_open(&snoop->filep, filename, O_RDWR | O_CREAT | O_CLOEXEC,
0666);
if (ret < 0)
{
return ret;