posix: device_io: use mode argument correctly in open()
Previously, we had only used the flags field and ignored mode with the open() function. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
ab8b28ed7b
commit
748252aa76
6 changed files with 50 additions and 21 deletions
|
@ -30,7 +30,7 @@ static int test_mkdir(void)
|
|||
return res;
|
||||
}
|
||||
|
||||
res = open(TEST_DIR_FILE, O_CREAT | O_RDWR);
|
||||
res = open(TEST_DIR_FILE, O_CREAT | O_RDWR, 0770);
|
||||
|
||||
if (res < 0) {
|
||||
TC_PRINT("Failed opening file [%d]\n", res);
|
||||
|
|
|
@ -16,7 +16,7 @@ static int test_file_open(void)
|
|||
{
|
||||
int res;
|
||||
|
||||
res = open(TEST_FILE, O_CREAT | O_RDWR);
|
||||
res = open(TEST_FILE, O_CREAT | O_RDWR, 0660);
|
||||
if (res < 0) {
|
||||
TC_ERROR("Failed opening file: %d, errno=%d\n", res, errno);
|
||||
/* FIXME: restructure tests as per #46897 */
|
||||
|
|
|
@ -60,7 +60,7 @@ static int test_file_open_flags(void)
|
|||
|
||||
/* 2 Create file for read only, attempt to read, attempt to write */
|
||||
TC_PRINT("Open on non-existent file, flags = O_CREAT | O_WRONLY\n");
|
||||
fd = open(THE_FILE, O_CREAT | O_WRONLY);
|
||||
fd = open(THE_FILE, O_CREAT | O_WRONLY, 0440);
|
||||
if (fd < 0) {
|
||||
TC_PRINT("Expected success; fd = %d, errno = %d\n", fd, errno);
|
||||
return TC_FAIL;
|
||||
|
@ -236,7 +236,7 @@ static int test_file_open_flags(void)
|
|||
TC_PRINT("Attempt write to file opened with O_APPEND | O_RDWR\n");
|
||||
/* Clean start */
|
||||
unlink(THE_FILE);
|
||||
fd = open(THE_FILE, O_CREAT | O_WRONLY);
|
||||
fd = open(THE_FILE, O_CREAT | O_WRONLY, 0440);
|
||||
if (fd < 0) {
|
||||
TC_PRINT("Expected success, fd = %d, errno = %d\n", fd, errno);
|
||||
return TC_FAIL;
|
||||
|
|
|
@ -24,7 +24,7 @@ static void create_file(const char *filename, uint32_t size)
|
|||
{
|
||||
int fh;
|
||||
|
||||
fh = open(filename, O_CREAT | O_WRONLY);
|
||||
fh = open(filename, O_CREAT | O_WRONLY, 0440);
|
||||
zassert(fh >= 0, "Failed creating test file");
|
||||
|
||||
uint8_t filling[FILL_SIZE];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue