Skip to content

Commit 512a6f8

Browse files
de-nordicnashif
authored andcommitted
fs: shell: Add fs_file_t type variable initializations
The commit adds initializations of fs_file_t variables in preparation for fs_open function change that will require fs_file_t object, passed to the function, to be initialized before first usage. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 44ee6fd commit 512a6f8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

subsys/fs/shell.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ static int cmd_trunc(const struct shell *shell, size_t argc, char **argv)
188188
length = 0;
189189
}
190190

191+
fs_file_t_init(&file);
191192
err = fs_open(&file, path, FS_O_CREATE | FS_O_RDWR);
192193
if (err) {
193194
shell_error(shell, "Failed to open %s (%d)", path, err);
@@ -277,6 +278,7 @@ static int cmd_read(const struct shell *shell, size_t argc, char **argv)
277278

278279
shell_print(shell, "File size: %zd", dirent.size);
279280

281+
fs_file_t_init(&file);
280282
err = fs_open(&file, path, FS_O_CREATE | FS_O_RDWR);
281283
if (err) {
282284
shell_error(shell, "Failed to open %s (%d)", path, err);
@@ -376,6 +378,7 @@ static int cmd_write(const struct shell *shell, size_t argc, char **argv)
376378
arg_offset = 2;
377379
}
378380

381+
fs_file_t_init(&file);
379382
err = fs_open(&file, path, FS_O_CREATE | FS_O_RDWR);
380383
if (err) {
381384
shell_error(shell, "Failed to open %s (%d)", path, err);

0 commit comments

Comments
 (0)