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

LibC: Fix getline() forgetting to null-terminate on EOF

This commit is contained in:
Sergey Bugaev 2020-03-26 10:09:31 +03:00 committed by Andreas Kling
parent db4da68618
commit 5ba8247cbb

View file

@ -193,6 +193,7 @@ ssize_t getdelim(char** lineptr, size_t* n, int delim, FILE* stream)
int c = fgetc(stream);
if (c == -1) {
if (feof(stream)) {
*ptr = '\0';
return ptr == *lineptr ? -1 : ptr - *lineptr;
} else {
return -1;