diff --git a/libc/src/stdio.cpp b/libc/src/stdio.cpp index d21960ac..3a9365e8 100644 --- a/libc/src/stdio.cpp +++ b/libc/src/stdio.cpp @@ -135,6 +135,8 @@ static ssize_t read_data_into_buffer(FILE* stream) stream->_buf.index = 0; ssize_t nread = read(stream->_fd, stream->_buf.buffer, stream->_buf.capacity); if (nread >= 0) stream->_buf.size = nread; + else + stream->_buf.size = 0; stream->_buf.status |= FileStatusFlags::LastRead; return nread; }