Skip to content

Commit bbacab8

Browse files
de-nordicMaureenHelm
authored andcommitted
fs: shell: cmd_read does should open file for read-only
The cmd_read function uses fs_open with FS_O_CREATE | FS_O_RDWR flags to open file it will only read; the flags has been changed to FS_O_READ. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 263ac3e commit bbacab8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/fs/shell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static int cmd_read(const struct shell *shell, size_t argc, char **argv)
281281
shell_print(shell, "File size: %zd", dirent.size);
282282

283283
fs_file_t_init(&file);
284-
err = fs_open(&file, path, FS_O_CREATE | FS_O_RDWR);
284+
err = fs_open(&file, path, FS_O_READ);
285285
if (err) {
286286
shell_error(shell, "Failed to open %s (%d)", path, err);
287287
return -ENOEXEC;

0 commit comments

Comments
 (0)