summaryrefslogtreecommitdiff
path: root/nuttx/lib/stdio/lib_libflushall.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/lib/stdio/lib_libflushall.c')
-rw-r--r--nuttx/lib/stdio/lib_libflushall.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/nuttx/lib/stdio/lib_libflushall.c b/nuttx/lib/stdio/lib_libflushall.c
index de2853df8..0b95fc22d 100644
--- a/nuttx/lib/stdio/lib_libflushall.c
+++ b/nuttx/lib/stdio/lib_libflushall.c
@@ -121,7 +121,7 @@ int lib_flushall(FAR struct streamlist *list)
* to flush all of the buffered write data. Return EOF on failure.
*/
- lasterrno = *get_errno_ptr();
+ lasterrno = get_errno();
ret = ERROR;
}
}
@@ -131,6 +131,9 @@ int lib_flushall(FAR struct streamlist *list)
/* If any flush failed, return that last failed flush */
- *get_errno_ptr() = lasterrno;
+ if (ret != OK)
+ {
+ set_errno(lasterrno);
+ }
return ret;
}