summaryrefslogtreecommitdiff
path: root/Libraries/LibC/stdio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibC/stdio.cpp')
-rw-r--r--Libraries/LibC/stdio.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/Libraries/LibC/stdio.cpp b/Libraries/LibC/stdio.cpp
index 05f60495ac..713853caaf 100644
--- a/Libraries/LibC/stdio.cpp
+++ b/Libraries/LibC/stdio.cpp
@@ -129,12 +129,9 @@ int fgetc(FILE* stream)
assert(stream);
char ch;
size_t nread = fread(&ch, sizeof(char), 1, stream);
- if (nread <= 0) {
- stream->eof = nread == 0;
- stream->error = errno;
- return EOF;
- }
- return ch;
+ if (nread == 1)
+ return ch;
+ return EOF;
}
int getc(FILE* stream)