mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-23 13:57:04 +00:00
LibC: Fix getline() forgetting to null-terminate on EOF
This commit is contained in:
committed by
Andreas Kling
parent
db4da68618
commit
5ba8247cbb
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user