hi~
I connected the target board to terminal via "telnet" , in some cases
the terminal will be frozen. Here are detailed steps:
1. Enable "CONFIG_IOB_DEBUG"[necessary].
2. New two terminals and connect to target board via "telnet".
3. Input "dmesg" command,and the terminal will show information
*continuously*.[two terminals are same][necessary]
4. Close one of the terminals,and the other one will be frozen.but the
system is work on.
I debug the system and repaired the bug,the file named commit.txt is
detailed steps.
BR,
wei peng
diff --git a/nuttx/include/stdio.h b/nuttx/include/stdio.h
index 9a13052..033acbb 100755
--- a/nuttx/include/stdio.h
+++ b/nuttx/include/stdio.h
@@ -161,7 +161,7 @@ FAR FILE *freopen(FAR const char *path, FAR const char
*mode,
int fseek(FAR FILE *stream, long int offset, int whence);
int fsetpos(FAR FILE *stream, FAR fpos_t *pos);
long ftell(FAR FILE *stream);
-size_t fwrite(FAR const void *ptr, size_t size, size_t n_items,
+ssize_t fwrite(FAR const void *ptr, size_t size, size_t n_items,
FAR FILE *stream);
FAR char *gets(FAR char *s);
FAR char *gets_s(FAR char *s, rsize_t n);
diff --git a/nuttx/libs/libc/stdio/lib_fwrite.c
b/nuttx/libs/libc/stdio/lib_fwrite.c
index 6426b70..4713fa0 100755
--- a/nuttx/libs/libc/stdio/lib_fwrite.c
+++ b/nuttx/libs/libc/stdio/lib_fwrite.c
@@ -52,7 +52,7 @@
* Name: fwrite
****************************************************************************/
-size_t fwrite(FAR const void *ptr, size_t size, size_t n_items,
+ssize_t fwrite(FAR const void *ptr, size_t size, size_t n_items,
FAR FILE *stream)
{
size_t full_size = n_items * (size_t)size;
@@ -67,6 +67,8 @@ size_t fwrite(FAR const void *ptr, size_t size, size_t
n_items,
/* Return the number of full items written */
items_written = bytes_written / size;
+ }else{
+ items_written = bytes_written;
}
return items_written;
diff --git a/apps/nshlib/nsh_fsutils.c b/apps/nshlib/nsh_fsutils.c
index f6545d6..3eb2e7f 100755
--- a/apps/nshlib/nsh_fsutils.c
+++ b/apps/nshlib/nsh_fsutils.c
@@ -98,7 +98,7 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char
*cmd,
/* And just dump it byte for byte into stdout */
- for (;;)
+ while (ret >= 0)
{
int nbytesread = read(fd, buffer, IOBUFFERSIZE);