1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibC: ungetc(EOF) should fail (and return EOF)

This commit is contained in:
Andreas Kling 2019-09-22 19:51:39 +02:00
parent bba24b09f7
commit 64948fa701

View file

@ -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;