summaryrefslogtreecommitdiff
path: root/nuttx/lib/stdio/lib_fgets.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/lib/stdio/lib_fgets.c')
-rw-r--r--nuttx/lib/stdio/lib_fgets.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/nuttx/lib/stdio/lib_fgets.c b/nuttx/lib/stdio/lib_fgets.c
index 3f72f0000..ce2aa9476 100644
--- a/nuttx/lib/stdio/lib_fgets.c
+++ b/nuttx/lib/stdio/lib_fgets.c
@@ -97,7 +97,10 @@ static const char g_erasetoeol[] = "\033[K";
static inline int _lib_rawgetc(int fd)
{
char buffer;
- if (read(fd, &buffer, 1) < 1)
+ ssize_t nread;
+
+ nread = read(fd, &buffer, 1);
+ if (nread < 1)
{
/* Return EOF if the end of file (0) or error (-1) occurs */