summaryrefslogtreecommitdiff
path: root/nuttx/lib/stdio/lib_fputc.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/lib/stdio/lib_fputc.c')
-rw-r--r--nuttx/lib/stdio/lib_fputc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/nuttx/lib/stdio/lib_fputc.c b/nuttx/lib/stdio/lib_fputc.c
index 34ef7aa25..917fcc10a 100644
--- a/nuttx/lib/stdio/lib_fputc.c
+++ b/nuttx/lib/stdio/lib_fputc.c
@@ -87,14 +87,17 @@
int fputc(int c, FAR FILE *stream)
{
unsigned char buf = (unsigned char)c;
- if (lib_fwrite(&buf, 1, stream) > 0)
+ int ret;
+
+ ret = lib_fwrite(&buf, 1, stream);
+ if (ret > 0)
{
/* Flush the buffer if a newline is output */
#ifdef CONFIG_STDIO_LINEBUFFER
if (c == '\n')
{
- int ret = lib_fflush(stream, true);
+ ret = lib_fflush(stream, true);
if (ret < 0)
{
return EOF;