This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 5c703f5603f3cea92c82a46c650435f430b03e33 Author: Nightt <[email protected]> AuthorDate: Tue May 19 17:43:05 2026 +0800 nshlib/testing: Fix open() arguments. Pass explicit open flags for the NSH script redirect file so the mode argument is used as file creation permissions. Add the missing mode argument to AIO ostest open() calls that create the test file. Signed-off-by: Nightt <[email protected]> --- nshlib/nsh_script.c | 3 ++- testing/ostest/aio.c | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/nshlib/nsh_script.c b/nshlib/nsh_script.c index 21bef19e4..d1f1d369e 100644 --- a/nshlib/nsh_script.c +++ b/nshlib/nsh_script.c @@ -61,7 +61,8 @@ static int nsh_script_redirect(FAR struct nsh_vtbl_s *vtbl, if (CONFIG_NSH_SCRIPT_REDIRECT_PATH[0]) { - fd = open(CONFIG_NSH_SCRIPT_REDIRECT_PATH, 0666); + fd = open(CONFIG_NSH_SCRIPT_REDIRECT_PATH, + O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd > 0) { nsh_redirect(vtbl, 0, fd, fd, save); diff --git a/testing/ostest/aio.c b/testing/ostest/aio.c index 8a6fe9637..e69d3a5e7 100644 --- a/testing/ostest/aio.c +++ b/testing/ostest/aio.c @@ -299,7 +299,7 @@ void aio_test(void) /* Case 1: Poll for transfer complete */ printf("AIO test case 1: Poll for transfer complete\n"); - g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC); + g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC, 0666); if (g_fildes < 0) { printf("aio_test: ERROR: Failed to open %s: %d\n", @@ -336,7 +336,7 @@ void aio_test(void) usleep(500 * 1000); printf("AIO test case 2: Use LIO_WAIT for transfer complete\n"); - g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC); + g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC, 0666); if (g_fildes < 0) { printf("aio_test: ERROR: Failed to open %s: %d\n", @@ -374,7 +374,7 @@ void aio_test(void) usleep(500 * 1000); printf("AIO test case 3: Use aio_suspend for transfer complete\n"); - g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC); + g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC, 0666); if (g_fildes < 0) { printf("aio_test: ERROR: Failed to open %s: %d\n", @@ -442,7 +442,7 @@ void aio_test(void) usleep(500 * 1000); printf("AIO test case 4: Use individual signals for transfer complete\n"); - g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC); + g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC, 0666); if (g_fildes < 0) { printf("aio_test: ERROR: Failed to open %s: %d\n", @@ -506,7 +506,7 @@ void aio_test(void) printf("AIO test case 5:" " Use list complete signal for transfer complete\n"); - g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC); + g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC, 0666); if (g_fildes < 0) { printf("aio_test: ERROR: Failed to open %s: %d\n", @@ -569,7 +569,7 @@ void aio_test(void) usleep(500 * 1000); printf("AIO test case 6: Cancel I/O by AIO control block\n"); - g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC); + g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC, 0666); if (g_fildes < 0) { printf("aio_test: ERROR: Failed to open %s: %d\n", @@ -616,7 +616,7 @@ void aio_test(void) usleep(500 * 1000); printf("AIO test case 7:Cancel I/O by file descriptor\n"); - g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC); + g_fildes = open(AIO_FILEPATH, O_RDWR | O_CREAT | O_TRUNC, 0666); if (g_fildes < 0) { printf("aio_test: ERROR: Failed to open %s: %d\n",
