apps: Fix additional open() arguments.

Add missing mode arguments to direct open() calls that use O_CREAT.

Also open the lp503x device with explicit read-only flags instead of O_CREAT, matching the device-node usage.

Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
This commit is contained in:
Nightt 2026-05-19 17:56:09 +08:00 committed by Xiang Xiao
parent 5c703f5603
commit b4f1e29494
12 changed files with 15 additions and 14 deletions

View file

@ -382,7 +382,8 @@ static int audio_test_prepare(FAR struct audio_state_s *state,
}
else
{
state->out_fd = open(state->outfile, O_WRONLY | O_CREAT | O_TRUNC);
state->out_fd = open(state->outfile,
O_WRONLY | O_CREAT | O_TRUNC, 0666);
}
if (state->out_fd == -1)

View file

@ -160,7 +160,7 @@ static bool create_files(const char *dir, const char *name,
bytes[j] = (bytes[j] + i) & 0xff;
}
int fd = open(path, O_CREAT | O_RDWR);
int fd = open(path, O_CREAT | O_RDWR, 0666);
if (fd < 0)
{

View file

@ -393,7 +393,7 @@ static int smart_circular_log_test(char *filename)
/* Open the circular log file */
fd = open(filename, O_RDWR | O_CREAT);
fd = open(filename, O_RDWR | O_CREAT, 0666);
if (fd == -1)
{
printf("Unable to create file %s\n", filename);

View file

@ -59,13 +59,13 @@ void test_nuttx_fs_poll01(FAR void **state)
int poll01_ret;
struct pollfd poll01_fds[5];
poll01_fd1 = open(I_FILE1, O_RDONLY | O_CREAT);
poll01_fd1 = open(I_FILE1, O_RDONLY | O_CREAT, 0666);
assert_true(poll01_fd1 >= 0);
poll01_fds[0].fd = poll01_fd1;
poll01_fds[0].events = POLLOUT;
poll01_fd2 = open(I_FILE2, O_RDWR | O_CREAT);
poll01_fd2 = open(I_FILE2, O_RDWR | O_CREAT, 0666);
assert_true(poll01_fd2 >= 0);
poll01_fds[1].fd = poll01_fd2;

View file

@ -306,7 +306,7 @@ void test_nuttx_syscall_fcntl06(FAR void **state)
sprintf(fname, "fcntl06_%d", gettid());
fd = open(fname, O_RDWR | O_CREAT);
fd = open(fname, O_RDWR | O_CREAT, 0700);
assert_true(fd > 0);
for (lc = 0; lc < 10; lc++)

View file

@ -91,7 +91,7 @@ void test_nuttx_syscall_lseek01(FAR void **state)
snprintf(filename, sizeof(filename), "%s_file", __func__);
fd = open(filename, O_RDWR | O_CREAT);
fd = open(filename, O_RDWR | O_CREAT, 0644);
if (fd > 0)
{

View file

@ -103,7 +103,7 @@ void test_nuttx_syscall_rmdir02(FAR void **state)
assert_int_equal(ret, 0);
ret = mkdir("Rmdir02_testdir/test1", (S_IRWXU | S_IRWXG | S_IRWXO));
assert_int_equal(ret, 0);
fd = open("Rmdir02_testfile2", O_CREAT | O_RDWR);
fd = open("Rmdir02_testfile2", O_CREAT | O_RDWR, 0700);
if (fd > 0)
close(fd);

View file

@ -55,7 +55,7 @@ void test_nuttx_syscall_unlink01(FAR void **state)
sprintf(fname, "%s_file", __func__);
fd = open(fname, O_RDWR | O_CREAT);
fd = open(fname, O_RDWR | O_CREAT, 0700);
if (fd > 0)
{
close(fd);