diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-03 15:38:26 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-03 15:38:26 +0000 |
commit | 01429708989552ee1ce78a662e4bdc9145b49c72 (patch) | |
tree | 143330a4fc2da15fc71810551fa4733abd9b04bc /nuttx/lib/stdio | |
parent | 80d5b281209708972a1e484f10f9b1cf74868ea4 (diff) | |
download | px4-nuttx-01429708989552ee1ce78a662e4bdc9145b49c72.tar.gz px4-nuttx-01429708989552ee1ce78a662e4bdc9145b49c72.tar.bz2 px4-nuttx-01429708989552ee1ce78a662e4bdc9145b49c72.zip |
Fix a nasty bug that was closing stdin
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3663 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/lib/stdio')
-rw-r--r-- | nuttx/lib/stdio/lib_fgets.c | 5 |
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 */ |