diff options
Diffstat (limited to 'nuttx/lib/stdio/lib_puts.c')
-rw-r--r-- | nuttx/lib/stdio/lib_puts.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/nuttx/lib/stdio/lib_puts.c b/nuttx/lib/stdio/lib_puts.c index e8cb186f6..088d0f043 100644 --- a/nuttx/lib/stdio/lib_puts.c +++ b/nuttx/lib/stdio/lib_puts.c @@ -93,6 +93,7 @@ int puts(FAR const char *s) FILE *stream = stdout; int nwritten; int nput = EOF; + int ret; /* Write the string (the next two steps must be atomic) */ @@ -106,20 +107,19 @@ int puts(FAR const char *s) /* Followed by a newline */ char newline = '\n'; - if (lib_fwrite(&newline, 1, stream) > 0) + ret = lib_fwrite(&newline, 1, stream); + if (ret > 0) { nput = nwritten + 1; /* Flush the buffer after the newline is output */ #ifdef CONFIG_STDIO_LINEBUFFER - { - int ret = lib_fflush(stream, true); - if (ret < 0) - { - nput = EOF; - } - } + ret = lib_fflush(stream, true); + if (ret < 0) + { + nput = EOF; + } #endif } } |