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:
parent
db4da68618
commit
5ba8247cbb
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue