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.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Libraries/LibC/stdio.cpp b/Libraries/LibC/stdio.cpp
index bce13c7f79..db3dc57451 100644
--- a/Libraries/LibC/stdio.cpp
+++ b/Libraries/LibC/stdio.cpp
@@ -190,6 +190,8 @@ ssize_t getline(char **lineptr, size_t *n, FILE *stream)
int ungetc(int c, FILE* stream)
{
ASSERT(stream);
+ if (c == EOF)
+ return EOF;
if (stream->have_ungotten)
return EOF;
stream->have_ungotten = true;