diff --git a/source/shell/mufs.c b/source/shell/mufs.c index 6a8cd8d..e1d472c 100644 --- a/source/shell/mufs.c +++ b/source/shell/mufs.c @@ -159,6 +159,7 @@ int shell_cat(struct console *con, size_t argc, const char **argv) { char data[256]; struct mufs_file *file; + size_t ret; if (argc < 1) { fprintf(con->fp, "usage: mufs cat \n"); @@ -175,8 +176,8 @@ int shell_cat(struct console *con, size_t argc, const char **argv) return -1; } - while (mufs_read(file, data, sizeof data) != 0) { - fwrite(data, sizeof *data, sizeof data, con->fp); + while ((ret = mufs_read(file, data, sizeof data)) != 0) { + fwrite(data, sizeof *data, ret, con->fp); } mufs_close(file);