shell: use amount of bytes returned from mufs_read()

master
S.J.R. van Schaik 7 years ago
parent d1457e8be6
commit 6fb626d601
  1. 5
      source/shell/mufs.c

@ -159,6 +159,7 @@ int shell_cat(struct console *con, size_t argc, const char **argv)
{ {
char data[256]; char data[256];
struct mufs_file *file; struct mufs_file *file;
size_t ret;
if (argc < 1) { if (argc < 1) {
fprintf(con->fp, "usage: mufs cat <path>\n"); fprintf(con->fp, "usage: mufs cat <path>\n");
@ -175,8 +176,8 @@ int shell_cat(struct console *con, size_t argc, const char **argv)
return -1; return -1;
} }
while (mufs_read(file, data, sizeof data) != 0) { while ((ret = mufs_read(file, data, sizeof data)) != 0) {
fwrite(data, sizeof *data, sizeof data, con->fp); fwrite(data, sizeof *data, ret, con->fp);
} }
mufs_close(file); mufs_close(file);

Loading…
Cancel
Save